JavaのIOバイトストリームと文字ストリーム

836 ワード

JavaのIOは2つの線、バイトストリーム、文字ストリームに分かれています
バイトストリームベースクラス:InputStream/OutputStreamオペレーションbyte[]の
I部分:
public abstract int read() throws IOException;

 
O部分:
public abstract void write(int b) throws IOException;

 
文字ストリームベースクラス:Reader/Writer 操作char[]の
I部分:
abstract public void close() throws IOException;
abstract public int read(char cbuf[], int off, int len) throws IOException;

O部分:
abstract public void write(char cbuf[], int off, int len) throws IOException;
abstract public void flush() throws IOException;
abstract public void close() throws IOException;

 
ブリッジの変換:
InputStreamReaderとOutputStreamWriter