Package com.ctc.wstx.io
Class UTF8Writer
- java.lang.Object
-
- java.io.Writer
-
- com.ctc.wstx.io.UTF8Writer
-
- All Implemented Interfaces:
CompletelyCloseable
,Closeable
,Flushable
,Appendable
,AutoCloseable
public final class UTF8Writer extends Writer implements CompletelyCloseable
Specialized buffering UTF-8 writer used byXmlWriter
. The main reason for custom version is to allow for efficient buffer recycling; the second benefit is that encoder has less overhead for short content encoding (compared to JDK default codecs).
-
-
Constructor Summary
Constructors Constructor Description UTF8Writer(WriterConfig cfg, OutputStream out, boolean autoclose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
closeCompletely()
void
flush()
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)
-
-
-
Constructor Detail
-
UTF8Writer
public UTF8Writer(WriterConfig cfg, OutputStream out, boolean autoclose)
-
-
Method Detail
-
closeCompletely
public void closeCompletely() throws IOException
- Specified by:
closeCompletely
in interfaceCompletelyCloseable
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
write
public void write(char[] cbuf) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOException
- Specified by:
write
in classWriter
- Throws:
IOException
-
write
public void write(int c) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
public void write(String str) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
public void write(String str, int off, int len) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
-