public class UTF8OutputStreamWriter extends Writer
This class is used to write a stream of chars as a stream of bytes using the UTF8 encoding. It assumes that the underlying output stream is buffered or does not need additional buffering.
It is more efficient than using a OutputStreamWriter
because it does not need to be wrapped in a
BufferedWriter
. Creating multiple instances
of BufferedWriter
has been shown to be very expensive.
copy from: com.sun.xml.internal.stream.writers.UTF8OutputStreamWriter
Constructor and Description |
---|
UTF8OutputStreamWriter(OutputStream out)
Creates a new UTF8OutputStreamWriter.
|
public UTF8OutputStreamWriter(OutputStream out)
out
- The underlying output stream.public void write(int c) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
public void write(String str) throws IOException
write
in class Writer
IOException
public void write(String str, int off, int len) throws IOException
write
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
Copyright © 2025. All rights reserved.