2013-07-03 02:52:38 +00:00
|
|
|
/* Copyright (c) 2008-2013, Avian Contributors
|
2008-02-19 18:06:52 +00:00
|
|
|
|
|
|
|
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];
|
2009-08-13 14:55:35 +00:00
|
|
|
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;
|
|
|
|
}
|