Package org.apache.johnzon.core.io
Class BoundedOutputStreamWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.BufferedWriter
-
- org.apache.johnzon.core.io.BoundedOutputStreamWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class BoundedOutputStreamWriter extends BufferedWriter
ABufferedWriterthat wraps anOutputStreamWriterand automatically flushes it when flushing its internal buffer. It enables to wrap anOutputStreamas aWriterbut with a faster feedback than a defaultOutputStreamWriterwhich uses a 8k buffer by default (encapsulated).
-
-
Field Summary
Fields Modifier and Type Field Description private intbufferSizeprivate intwrittenSinceLastFlush
-
Constructor Summary
Constructors Constructor Description BoundedOutputStreamWriter(OutputStream outputStream, Charset charset, int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidautoFlush()voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(String s, int off, int len)-
Methods inherited from class java.io.BufferedWriter
close, flush, newLine
-
-
-
-
Constructor Detail
-
BoundedOutputStreamWriter
public BoundedOutputStreamWriter(OutputStream outputStream, Charset charset, int maxSize)
-
-
Method Detail
-
write
public void write(String s, int off, int len) throws IOException
- Overrides:
writein classBufferedWriter- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Overrides:
writein classBufferedWriter- Throws:
IOException
-
write
public void write(int c) throws IOException- Overrides:
writein classBufferedWriter- Throws:
IOException
-
autoFlush
private void autoFlush() throws IOException- Throws:
IOException
-
-