| java.lang.Object | ||
| ↳ | java.io.Writer | |
| ↳ | java.io.OutputStreamWriter | |
|  Known Direct Subclasses | 
A class for turning a character stream into a byte stream. Data written to
 the target input stream is converted into bytes by either a default or a
 provided character converter. The default encoding is taken from the
 "file.encoding" system property. OutputStreamWriter contains a buffer
 of bytes to be written to target stream and converts these into characters as
 needed. The buffer size is 8K.
| [Expand] Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
java.io.Writer | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Constructs a new OutputStreamWriter using  outas the target
 stream to write converted characters to. | |||||||||||
| Constructs a new OutputStreamWriter using  outas the target
 stream to write converted characters to andencas the character
 encoding. | |||||||||||
| Constructs a new OutputStreamWriter using  outas the target
 stream to write converted characters to andcsas the character
 encoding. | |||||||||||
| Constructs a new OutputStreamWriter using  outas the target
 stream to write converted characters to andencas the character
 encoder. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Closes this writer. | |||||||||||
| Flushes this writer. | |||||||||||
| Returns the historical name of the encoding used by this writer to convert characters to
 bytes, or null if this writer has been closed. | |||||||||||
| Writes  countcharacters starting atoffsetinbufto this writer. | |||||||||||
| Writes  countcharacters starting atoffsetinstrto this writer. | |||||||||||
| Writes the character  oneCharto 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 target
 stream to write converted characters to. The default character encoding
 is used.
| out | the non-null target stream to write converted bytes to. | 
|---|
Constructs a new OutputStreamWriter using out as the target
 stream to write converted characters to and enc as the character
 encoding. If the encoding cannot be found, an
 UnsupportedEncodingException error is thrown.
| out | the target stream to write converted bytes to. | 
|---|---|
| enc | the string describing the desired character encoding. | 
| NullPointerException | if encisnull. | 
|---|---|
| UnsupportedEncodingException | if the encoding specified by enccannot be found. | 
Constructs a new OutputStreamWriter using out as the target
 stream to write converted characters to and cs as the character
 encoding.
| out | the target stream to write converted bytes to. | 
|---|---|
| cs | the Charsetthat specifies the character encoding. | 
Constructs a new OutputStreamWriter using out as the target
 stream to write converted characters to and enc as the character
 encoder.
| out | the target stream to write converted bytes to. | 
|---|---|
| enc | the character encoder used for character conversion. | 
Closes this writer. This implementation flushes the buffer as well as the target stream. The target stream is then closed and the resources for the buffer and converter are released.
Only the first invocation of this method has any effect. Subsequent calls do nothing.
| IOException | if an error occurs while closing this writer. | 
|---|
Flushes this writer. This implementation ensures that all buffered bytes are written to the target stream. After writing the bytes, the target stream is flushed as well.
| IOException | if an error occurs while flushing this writer. | 
|---|
Returns the historical name of the encoding used by this writer to convert characters to bytes, or null if this writer has been closed. Most callers should probably keep track of the String or Charset they passed in; this method may not return the same name.
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 gets full
 as a result of the conversion, this writer is flushed.
| buffer | the array containing characters to write. | 
|---|---|
| offset | the index of the first character in bufto write. | 
| count | the maximum number of characters to write. | 
| IndexOutOfBoundsException | if offset < 0orcount < 0, or ifoffset + countis greater than the size ofbuf. | 
|---|---|
| IOException | if this writer has already been closed or another I/O error occurs. | 
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 gets full
 as a result of the conversion, this writer is flushed.
| str | the string containing characters to write. | 
|---|---|
| offset | the start position in strfor retrieving characters. | 
| count | the maximum number of characters to write. | 
| IOException | if this writer has already been closed or another I/O error occurs. | 
|---|---|
| IndexOutOfBoundsException | if offset < 0orcount < 0, or ifoffset + countis bigger than the length ofstr. | 
Writes the character oneChar to this writer. The lowest two bytes
 of the integer oneChar are immediately converted to bytes by the
 character converter and stored in a local buffer. If the buffer gets full
 by converting this character, this writer is flushed.
| oneChar | the character to write. | 
|---|
| IOException | if this writer is closed or another I/O error occurs. | 
|---|