public class UnicodeOutputStreamWriter extends Writer
OutputStreamWriter that is BOM-aware. It can
operate in any of the following modes:
| Modifier | Constructor and Description |
|---|---|
|
UnicodeOutputStreamWriter(OutputStream stream)
Creates a new writer over the given stream that uses the
default JVM charset (and no signature is injected).
|
|
UnicodeOutputStreamWriter(OutputStream stream,
Reader reader)
Creates a new writer over the given stream that uses the actual
signature/charset of the given reader.
|
protected |
UnicodeOutputStreamWriter(OutputStream stream,
Reader reader,
boolean writeSignature)
Creates a new writer over the given stream that uses the actual
signature/charset of the given reader.
|
|
UnicodeOutputStreamWriter(OutputStream stream,
SignatureCharset requestedSignatureCharset)
Creates a new writer over the given stream that normally
injects the given signature, and uses its associated charset
for encoding.
|
protected |
UnicodeOutputStreamWriter(OutputStream stream,
SignatureCharset requestedSignatureCharset,
boolean writeSignature)
Creates a new writer over the given stream that normally
injects the given signature, and uses its associated charset
for encoding.
|
| Modifier and Type | Method and Description |
|---|---|
Writer |
append(char c) |
Writer |
append(CharSequence csq) |
Writer |
append(CharSequence csq,
int start,
int end) |
void |
close() |
void |
flush() |
SignatureCharset |
getRequestedSignatureCharset()
Returns the receiver's requested signature/charset.
|
SignatureCharset |
getSignatureCharset()
Returns the receiver's actual signature/charset (that is, the
one in use to encode the stream).
|
void |
write(char[] cbuf) |
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c) |
void |
write(String str) |
void |
write(String str,
int off,
int len) |
public UnicodeOutputStreamWriter(OutputStream stream)
stream - The stream.protected UnicodeOutputStreamWriter(OutputStream stream, SignatureCharset requestedSignatureCharset, boolean writeSignature)
stream - The stream.requestedSignatureCharset - The signature/charset. It may
be null to use the default JVM charset.writeSignature - True if a signature (if any) should be
written.public UnicodeOutputStreamWriter(OutputStream stream, SignatureCharset requestedSignatureCharset)
stream - The stream.requestedSignatureCharset - The signature/charset. It may
be null to use the default JVM charset.protected UnicodeOutputStreamWriter(OutputStream stream, Reader reader, boolean writeSignature) throws IOException
UnicodeInputStreamReader, or if it
used the default JVM charset, then the writer uses the default
JVM charset (and no signature is injected). Signature injection
is also skipped if the given flag is set to false (even if the
given reader's signature/charset pair has a signature).stream - The stream.reader - The reader.writeSignature - True if a signature (if any) should be
written.IOException - Thrown if an I/O error occurs.public UnicodeOutputStreamWriter(OutputStream stream, Reader reader) throws IOException
UnicodeInputStreamReader, or if it
used the default JVM charset, then the writer uses the default
JVM charset (and no signature is injected).stream - The stream.reader - The reader.IOException - Thrown if an I/O error occurs.public void write(int c)
throws IOException
write in class WriterIOExceptionpublic void write(char[] cbuf)
throws IOException
write in class WriterIOExceptionpublic void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionpublic void write(String str) throws IOException
write in class WriterIOExceptionpublic void write(String str, int off, int len) throws IOException
write in class WriterIOExceptionpublic Writer append(CharSequence csq) throws IOException
append in interface Appendableappend in class WriterIOExceptionpublic Writer append(CharSequence csq, int start, int end) throws IOException
append in interface Appendableappend in class WriterIOExceptionpublic Writer append(char c) throws IOException
append in interface Appendableappend in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic SignatureCharset getRequestedSignatureCharset()
public SignatureCharset getSignatureCharset() throws IOException
IOException - Thrown if an I/O error occurs.Copyright © 2015. All Rights Reserved.