public class ChannelBufferOutputStream extends OutputStreamChannel
Note that the close() method of this class does not closing the underlying channel.
| Modifier and Type | Field and Description |
|---|---|
protected ByteBuffer |
buffer |
static int |
DEFAULT_BUFFER_SIZE |
bytesWritten, channel, PARK_NANOS_MAX, parkedThread| Constructor and Description |
|---|
ChannelBufferOutputStream(WritableByteChannel channel) |
ChannelBufferOutputStream(WritableByteChannel channel,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
protected ByteBuffer |
allocateBuffer(int bufferSize) |
void |
close() |
void |
flush() |
protected void |
flushBufferBlocking(ByteBuffer buffer) |
boolean |
isOpen() |
void |
write(byte[] b,
int off,
int len) |
int |
write(ByteBuffer src) |
void |
write(int b) |
void |
writeInt(int v)
Writes an
int value, which is comprised of four bytes,
to the output stream in big-endian format
compatible with DataOutput.writeInt(int). |
flushBufferNonBlockingBase, getBytesWritten, getParkedThread, getParkNanosMax, getUnderlyingChannel, writeBuffer, writeBuffered, writeBufferNonBlockingwriteprotected final ByteBuffer buffer
public static final int DEFAULT_BUFFER_SIZE
public ChannelBufferOutputStream(WritableByteChannel channel) throws IOException
IOExceptionpublic ChannelBufferOutputStream(WritableByteChannel channel, int bufferSize) throws IOException
IOExceptionprotected ByteBuffer allocateBuffer(int bufferSize)
public final void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic final void write(@Nonnull byte[] b, int off, int len) throws IOException
write in class OutputStreamIOExceptionpublic final int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelwrite in class OutputStreamChannelIOExceptionpublic final void writeInt(int v)
throws IOException
int value, which is comprised of four bytes,
to the output stream in big-endian format
compatible with DataOutput.writeInt(int).writeInt in class OutputStreamChannelv - the int value to be written.IOException - if an I/O error occurs.DataOutput.writeInt(int)public void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic final boolean isOpen()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class OutputStreamIOExceptionprotected void flushBufferBlocking(ByteBuffer buffer) throws IOException
IOExceptionCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.