Package org.jline.utils
Class WriterOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.jline.utils.WriterOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class WriterOutputStream extends java.io.OutputStreamRedirects anOutputStreamto aWriterby decoding the data using the specifiedCharset.Note: This class should only be used if it is necessary to redirect an
OutputStreamto aWriterfor compatibility purposes. It is much more efficient to write to theWriterdirectly.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.charset.CharsetDecoderdecoderprivate java.nio.ByteBufferdecoderInprivate java.nio.CharBufferdecoderOutprivate java.io.Writerout
-
Constructor Summary
Constructors Constructor Description WriterOutputStream(java.io.Writer out, java.nio.charset.Charset charset)WriterOutputStream(java.io.Writer out, java.nio.charset.CharsetDecoder decoder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()private voidflushOutput()Flush the output.private voidprocessInput(boolean endOfInput)Decode the contents of the input ByteBuffer into a CharBuffer.voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
processInput
private void processInput(boolean endOfInput) throws java.io.IOExceptionDecode the contents of the input ByteBuffer into a CharBuffer.- Parameters:
endOfInput- indicates end of input- Throws:
java.io.IOException- if an I/O error occurs
-
flushOutput
private void flushOutput() throws java.io.IOExceptionFlush the output.- Throws:
java.io.IOException- if an I/O error occurs
-
-