I am writing an OutputStream, just noticed this in the OutputStream interface,
public abstract void write(int b) throws IOException;
This call write one byte to the stream but why it takes integer as an argument?
So you can signal EOF:
"Notice that read() returns an int value. If the input is a stream of bytes, why doesn't read() return a byte value? Using a int as a return type allows read() to use -1 to indicate that it has reached the end of the stream."
http://java.sun.com/docs/books/tutorial/essential/io/bytestreams.html