| java.lang.Object | ||
| ↳ | java.io.Writer | |
| ↳ | java.io.OutputStreamWriter | |
Known Direct Subclasses
|
OutputStreamWriter is a class for turning a character output stream into a byte output stream. The conversion of Unicode characters to their byte equivalents is determined by the converter used. By default, the encoding is ISO8859_1 (ISO-Latin-1) but can be changed by calling the constructor which takes an encoding.
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.Writer
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new OutputStreamWriter using
out as the
OutputStream to write converted characters to. | |||||||||||
Constructs a new OutputStreamWriter using
out as the
OutputStream to write converted characters to and enc as
the character encoding. | |||||||||||
Constructs a new OutputStreamWriter using
out as the
OutputStream to write converted characters to and cs as
the character encoding. | |||||||||||
Constructs a new OutputStreamWriter using
out as the
OutputStream to write converted characters to and enc as
the character encoding. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Close this OutputStreamWriter.
| |||||||||||
Flush this OutputStreamWriter.
| |||||||||||
Answer the String which identifies the encoding used to convert
characters to bytes.
| |||||||||||
Writes
count characters starting at offset
in buf to this Writer. | |||||||||||
Writes
count characters starting at offset
in str to this Writer. | |||||||||||
Writes out the character
oneChar to this Writer. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.io.Writer
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.io.Closeable
| |||||||||||
From interface java.io.Flushable
| |||||||||||
From interface java.lang.Appendable
| |||||||||||
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to. The default character
encoding is used (see class description).
| out | the non-null OutputStream to write converted bytes to. |
|---|
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to and enc as
the character encoding. If the encoding cannot be found, an
UnsupportedEncodingException error is thrown.
| out | the non-null OutputStream to write converted bytes to. |
|---|---|
| enc | the non-null String describing the desired character encoding. |
| UnsupportedEncodingException | if the encoding cannot be found. |
|---|
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to and cs as
the character encoding.
| out | the non-null OutputStream to write converted bytes to. |
|---|---|
| cs | the non-null Charset which specify the character encoding. |
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to and enc as
the character encoding.
| out | the non-null OutputStream to write converted bytes to. |
|---|---|
| enc | the non-null CharsetEncoder which used to character encoding. |
Close this OutputStreamWriter. This implementation first flushes the buffer and the target OutputStream. The OutputStream is then closed and the resources for the buffer and converter are freed.
Only the first invocation of this method has any effect. Subsequent calls do no work.
| IOException | If an error occurs attempting to close this OutputStreamWriter. |
|---|
Flush this OutputStreamWriter. This implementation ensures all buffered bytes are written to the target OutputStream. After writing the bytes, the target OutputStream is then flushed.
| IOException | If an error occurs attempting to flush this OutputStreamWriter. |
|---|
Answer the String which identifies the encoding used to convert
characters to bytes. The value null is returned if this
Writer has been closed.
Writes count characters starting at offset
in buf to this Writer. The characters are immediately
converted to bytes by the character converter and stored in a local
buffer. If the buffer becomes full as a result of this write, this Writer
is flushed.
| buf | the non-null array containing characters to write. |
|---|---|
| offset | offset in buf to retrieve characters |
| count | maximum number of characters to write |
| IOException | If this OutputStreamWriter has already been closed or some other IOException occurs. |
|---|---|
| IndexOutOfBoundsException | If offset or count is outside of bounds. |
Writes count characters starting at offset
in str to this Writer. The characters are immediately
converted to bytes by the character converter and stored in a local
buffer. If the buffer becomes full as a result of this write, this Writer
is flushed.
| str | the non-null String containing characters to write. |
|---|---|
| offset | offset in str to retrieve characters |
| count | maximum number of characters to write |
| IOException | If this OutputStreamWriter has already been closed or some other IOException occurs. |
|---|---|
| IndexOutOfBoundsException | If count is negative |
| StringIndexOutOfBoundsException | If offset is negative or offset + count is outside of bounds |
Writes out the character oneChar to this Writer. The
low-order 2 bytes are immediately converted to bytes by the character
converter and stored in a local buffer. If the buffer becomes full as a
result of this write, this Writer is flushed.
| oneChar | the character to write |
|---|
| IOException | If this OutputStreamWriter has already been closed or some other IOException occurs. |
|---|