public class NonBlockingBufferedOutputStream extends FilterOutputStream
BufferedOutputStream.BufferedOutputStream| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
m_aBuf
The internal buffer where data is stored.
|
protected int |
m_nCount
The number of valid bytes in the buffer.
|
out| Constructor and Description |
|---|
NonBlockingBufferedOutputStream(OutputStream aOS)
Creates a new buffered output stream to write data to the specified
underlying output stream.
|
NonBlockingBufferedOutputStream(OutputStream aOS,
int nSize)
Creates a new buffered output stream to write data to the specified
underlying output stream with the specified buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flushes this buffered output stream.
|
void |
write(byte[] aBuf,
int nOfs,
int nLen)
Writes
len bytes from the specified byte array starting at
offset off to this buffered output stream. |
void |
write(int b)
Writes the specified byte to this buffered output stream.
|
close, writeprotected byte[] m_aBuf
protected int m_nCount
public NonBlockingBufferedOutputStream(@Nonnull OutputStream aOS)
aOS - the underlying output stream.public NonBlockingBufferedOutputStream(@Nonnull OutputStream aOS, @Nonnegative int nSize)
aOS - the underlying output stream.nSize - the buffer size.IllegalArgumentException - if size <= 0.public void write(int b)
throws IOException
write in class FilterOutputStreamb - the byte to be written.IOException - if an I/O error occurs.public void write(byte[] aBuf,
int nOfs,
int nLen)
throws IOException
len bytes from the specified byte array starting at
offset off to this buffered output stream.
Ordinarily this method stores bytes from the given array into this stream's
buffer, flushing the buffer to the underlying output stream as needed. If
the requested length is at least as large as this stream's buffer, however,
then this method will flush the buffer and write the bytes directly to the
underlying output stream. Thus redundant BufferedOutputStreams
will not copy data unnecessarily.
write in class FilterOutputStreamaBuf - the data.nOfs - the start offset in the data.nLen - the number of bytes to write.IOException - if an I/O error occurs.public void flush()
throws IOException
flush in interface Flushableflush in class FilterOutputStreamIOException - if an I/O error occurs.Copyright © 2014–2015 Philip Helger. All rights reserved.