|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
java.io.OutputStreamWriter
public class OutputStreamWriter
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.
InputStreamReader| Field Summary |
|---|
| Fields inherited from class java.io.Writer |
|---|
lock, TOKEN_NULL |
| Constructor Summary | |
|---|---|
OutputStreamWriter(OutputStream out)
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to. |
|
OutputStreamWriter(OutputStream out,
Charset cs)
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to and cs as
the character encoding. |
|
OutputStreamWriter(OutputStream out,
CharsetEncoder enc)
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to and enc as
the character encoding. |
|
OutputStreamWriter(OutputStream out,
String enc)
Constructs a new OutputStreamWriter using out as the
OutputStream to write converted characters to and enc as
the character encoding. |
|
| Method Summary | |
|---|---|
void |
close()
Close this OutputStreamWriter. |
void |
flush()
Flush this OutputStreamWriter. |
String |
getEncoding()
Answer the String which identifies the encoding used to convert characters to bytes. |
void |
write(char[] buf,
int offset,
int count)
Writes count characters starting at offset
in buf to this Writer. |
void |
write(int oneChar)
Writes out the character oneChar to this Writer. |
void |
write(String str,
int offset,
int count)
Writes count characters starting at offset
in str to this Writer. |
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OutputStreamWriter(OutputStream out)
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.
public OutputStreamWriter(OutputStream out,
String enc)
throws UnsupportedEncodingException
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.
public OutputStreamWriter(OutputStream out,
Charset cs)
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.
public OutputStreamWriter(OutputStream out,
CharsetEncoder enc)
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.| Method Detail |
|---|
public void close()
throws IOException
Only the first invocation of this method has any effect. Subsequent calls do no work.
close in interface Closeableclose in class WriterIOException - If an error occurs attempting to close this
OutputStreamWriter.
public void flush()
throws IOException
flush in interface Flushableflush in class WriterIOException - If an error occurs attempting to flush this
OutputStreamWriter.public String getEncoding()
null is returned if this
Writer has been closed.
public void write(char[] buf,
int offset,
int count)
throws IOException
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.
write in class Writerbuf - the non-null array containing characters to write.offset - offset in buf to retrieve characterscount - 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.
public void write(int oneChar)
throws IOException
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.
write in class WriteroneChar - the character to write
IOException - If this OutputStreamWriter has already been closed or some
other IOException occurs.
public void write(String str,
int offset,
int count)
throws IOException
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.
write in class Writerstr - the non-null String containing characters to write.offset - offset in str to retrieve characterscount - 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
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||