Java Character Stream InputStreamReader/OutputStreamWriter
InputStreamReader Constructors
| Constructor | Description |
|---|---|
| InputStreamReader(InputStream in) | Creates an object that uses the default encoding for the given input byte stream in. |
| InputStreamReader(InputStream in, Charset cs) | Creates an object that uses the encoding of the cs character set to convert in into a character stream. |
| InputStreamReader(InputStream in, CharsetDecoder dec) | Creates an object that uses the decoder of the dec character set to convert in into a character stream. |
| InputStreamReader(InputStream in, String charsetName) | Creates an object that uses the encoding named by charsetName. |
InputStreamReader Methods
| Method | Description |
|---|---|
| void close() | Closes the InputStreamReader. |
| String getEncoding() | Gets the standard name of the character encoding currently being used. |
| int read() | Reads one character. (Returns -1 if none exists) |
| int read(char[] cbuf, int offset, int length) | Reads length characters from offset into the cbuf buffer. |
| boolean ready() | Checks whether characters are available to read from the InputStream. |
OutputStreamWriter Constructors
| Constructor | Description |
|---|---|
| OutputStreamWriter(OutputStream out) | Creates an object that uses the default encoding for the given output byte stream out. |
| OutputStreamWriter(OutputStream out, Charset cs) | Creates an object that uses the encoding of the cs character set to convert out into a byte stream. |
| OutputStreamWriter(OutputStream out, CharsetDecoder dec) | Creates an object that uses the decoder of the dec character set to convert out into a byte stream. |
| OutputStreamWriter(OutputStream out, String charsetName) | Creates an object that uses the encoding named by charsetName. |
OutputStreamWriter Methods
| Method | Description |
|---|---|
| void close() | Closes the OutputStreamWriter. |
| void flush() | Empties the OutputStreamWriter buffer. (Outputs it.) |
| String getEncoding() | Gets the standard name of the character encoding currently being used. |
| void write(char[] cbuf, int off, int len) | Writes characters by placing len characters from off into the cbuf buffer. |
| void write(int c) | Writes c characters. |
| void write(String str, int off, int len) | Writes len characters from off in the string str. |