|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object 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
and append
methods will throw
CharConversionException
if character encoding or escaping
fails.
This class is not thread safe.
This class implements all write
methods of Writer
,
but does not extend Writer
due to technical reasons.
Constructor Summary | |
---|---|
XMLCharacterEncoder(java.lang.Appendable a,
boolean isAppendable)
Constructs an XMLCharacterEncoder which writes to the given Appendable . |
|
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 | |
---|---|
java.lang.Appendable |
append(char c)
|
java.lang.Appendable |
append(java.lang.CharSequence cs)
|
java.lang.Appendable |
append(java.lang.CharSequence cs,
int start,
int end)
|
void |
close()
|
void |
finish()
|
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.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.public XMLCharacterEncoder(java.lang.Appendable a, boolean isAppendable)
Appendable
. Does not encode or escape.
a
- the Appendable
to write to.isAppendable
- dummy parameter to avoid overloading problemsMethod Detail |
---|
public java.lang.Appendable append(char c) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public java.lang.Appendable append(java.lang.CharSequence cs) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public java.lang.Appendable append(java.lang.CharSequence cs, int start, int end) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public void write(int c) throws java.io.IOException
java.io.IOException
public void write(char[] cbuf) throws java.io.IOException
java.io.IOException
public void write(char[] cbuf, int off, int len) throws java.io.IOException
java.io.IOException
public void write(java.lang.String str) throws java.io.IOException
java.io.IOException
public void write(java.lang.String str, int off, int len) throws java.io.IOException
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
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |