public abstract class EncodingWriter
extends java.lang.Object
create
and write()
at minimum. Efficient implementations will
also implement the write
into a buffer.
Implementations should not buffer the bytes.Modifier and Type | Field and Description |
---|---|
protected static java.util.logging.Logger |
log |
Constructor and Description |
---|
EncodingWriter() |
Modifier and Type | Method and Description |
---|---|
EncodingWriter |
create()
Returns a new encoding writer using the saved writer.
|
abstract EncodingWriter |
create(java.lang.String javaEncoding)
Returns a new encoding writer for the given stream and javaEncoding.
|
java.lang.String |
getJavaEncoding()
Returns the Java encoding for the writer.
|
void |
setJavaEncoding(java.lang.String encoding)
Sets the Java encoding for the writer.
|
abstract void |
write(ByteAppendable os,
char ch)
Writes the next character using the correct encoding.
|
int |
write(OutputStreamWithBuffer os,
char[] cbuf,
int off,
int len)
Writes a character buffer using the correct encoding.
|
public java.lang.String getJavaEncoding()
public void setJavaEncoding(java.lang.String encoding)
public abstract EncodingWriter create(java.lang.String javaEncoding)
javaEncoding
- the JDK name for the encoding.public EncodingWriter create()
public abstract void write(ByteAppendable os, char ch) throws java.io.IOException
ch
- the character to writejava.io.IOException
public int write(OutputStreamWithBuffer os, char[] cbuf, int off, int len) throws java.io.IOException
cbuf
- character buffer receiving the data.off
- starting offset into the buffer.len
- number of characters to writejava.io.IOException