|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
nu.staldal.xodus.XMLCharacterEncoder
public class XMLCharacterEncoder
Encodes output to an XML stream.
Inserts numeric character entities for characters which cannot be encoded in the specified encoding.
Note: Does not insert the gt, lt, qout, amp and apos entites.
The write
methods will throw CharConversionException
if character encoding or escaping fails.
This class is not thread safe.
Field Summary |
---|
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
XMLCharacterEncoder(java.io.OutputStream os,
java.lang.String encoding)
Constructs an XMLCharacterEncoder which writes to the given OutputStream . |
|
XMLCharacterEncoder(java.io.Writer writer)
Constructs an XMLCharacterEncoder which writes to the given Writer . |
Method Summary | |
---|---|
void |
close()
|
void |
disableEscaping()
Disable escaping with XML character entites. |
void |
enableEscaping()
Enable escaping with XML character entites. |
void |
finish()
Finish encoding and flush output, without closing underlaying stream. |
void |
flush()
|
void |
write(char[] cbuf)
|
void |
write(char[] cbuf,
int off,
int len)
|
void |
write(int c)
|
void |
write(java.lang.String str)
|
void |
write(java.lang.String str,
int off,
int len)
|
Methods inherited from class java.io.Writer |
---|
append, append, append |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLCharacterEncoder(java.io.OutputStream os, java.lang.String encoding) throws java.io.UnsupportedEncodingException
OutputStream
.
os
- the OutputStream
to write to.encoding
- the encoding to use.
java.io.UnsupportedEncodingException
- If the given encoding
name is illegal or not available.public XMLCharacterEncoder(java.io.Writer writer)
Writer
. Does not encode or escape.
writer
- the Writer
to write to.Method Detail |
---|
public void enableEscaping()
disableEscaping()
is invoked.
Note: Escaping is disabled at start.
public void disableEscaping()
enableEscaping()
is invoked.
Note: Escaping is disabled at start.
public void write(int c) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] cbuf) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(java.lang.String str) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public void finish() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.Writer
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |