classpath: Closeable & Flushable

This commit is contained in:
Pierre Carrier 2012-11-04 01:56:06 +01:00
parent 33fed1b710
commit be952acbcb
6 changed files with 36 additions and 4 deletions

View File

@ -0,0 +1,16 @@
/* Copyright (c) 2012, 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. */
package java.io;
public interface Closeable {
void close()
throws IOException;
}

View File

@ -0,0 +1,16 @@
/* Copyright (c) 2012, 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. */
package java.io;
public interface Flushable {
void flush()
throws IOException;
}

View File

@ -10,7 +10,7 @@
package java.io;
public abstract class InputStream {
public abstract class InputStream implements Closeable {
public abstract int read() throws IOException;
public int read(byte[] buffer) throws IOException {

View File

@ -10,7 +10,7 @@
package java.io;
public abstract class OutputStream {
public abstract class OutputStream implements Closeable, Flushable {
public abstract void write(int c) throws IOException;
public void write(byte[] buffer) throws IOException {

View File

@ -10,7 +10,7 @@
package java.io;
public abstract class Reader {
public abstract class Reader implements Closeable {
public int read() throws IOException {
char[] buffer = new char[1];
int c = read(buffer);

View File

@ -10,7 +10,7 @@
package java.io;
public abstract class Writer {
public abstract class Writer implements Closeable, Flushable {
public void write(int c) throws IOException {
char[] buffer = new char[] { (char) c };
write(buffer);