public class AsyncBufferedOutputStream extends FilterOutputStream
FilterOutputStream
that forwards data asynchronously (with a background thread) to the delegate
OutputStream
.out
Constructor and Description |
---|
AsyncBufferedOutputStream(OutputStream out,
ByteBuffer buffer,
boolean fair) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
write(byte[] ba,
int off,
int len) |
void |
write(int b) |
write
public AsyncBufferedOutputStream(OutputStream out, ByteBuffer buffer, boolean fair)
buffer
- Typically ByteBuffer.allocate(capacity)
for a heap buffer or ByteBuffer.allocateDirect(capacity)
for an off-heap bufferfair
- See ReentrantLock
public void write(int b) throws IOException
write
in class FilterOutputStream
IOException
- The background thread got this exceptionpublic void write(byte[] ba, int off, int len) throws IOException
write
in class FilterOutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class FilterOutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
Copyright © 2018 Arno Unkrig. All rights reserved.