corda/classpath/java/io/Writer.java

40 lines
1.1 KiB
Java
Raw Normal View History

2009-12-03 02:08:29 +00:00
/* Copyright (c) 2008-2009, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
2007-07-29 01:29:01 +00:00
package java.io;
2012-11-04 00:56:06 +00:00
public abstract class Writer implements Closeable, Flushable {
2007-07-29 01:29:01 +00:00
public void write(int c) throws IOException {
char[] buffer = new char[] { (char) c };
write(buffer);
}
public void write(char[] buffer) throws IOException {
write(buffer, 0, buffer.length);
}
2007-07-29 02:15:45 +00:00
public void write(String s) throws IOException {
write(s.toCharArray());
}
public void write(String s, int offset, int length) throws IOException {
char[] b = new char[length];
s.getChars(offset, offset + length, b, 0);
2007-07-29 02:15:45 +00:00
write(b);
}
2007-07-29 01:29:01 +00:00
public abstract void write(char[] buffer, int offset, int length)
throws IOException;
public abstract void flush() throws IOException;
public abstract void close() throws IOException;
}