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 java.nio.ByteBuffer |
buffer |
static int |
DEFAULT_BUFFER_SIZE |
bytesWritten, channel| Constructor and Description |
|---|
ChannelBufferOutputStream(java.nio.channels.WritableByteChannel channel) |
ChannelBufferOutputStream(java.nio.channels.WritableByteChannel channel,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
protected java.nio.ByteBuffer |
allocateBuffer(int bufferSize) |
void |
close() |
void |
flush() |
protected void |
flushBufferBlocking(java.nio.ByteBuffer buffer) |
boolean |
isOpen() |
void |
write(byte[] b,
int off,
int len) |
int |
write(java.nio.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, isSocketToSameHost, setParkedThread, writeBuffer, writeBuffered, writeBufferNoWaitprotected final java.nio.ByteBuffer buffer
public static final int DEFAULT_BUFFER_SIZE
public ChannelBufferOutputStream(java.nio.channels.WritableByteChannel channel)
throws java.io.IOException
java.io.IOExceptionpublic ChannelBufferOutputStream(java.nio.channels.WritableByteChannel channel,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionprotected java.nio.ByteBuffer allocateBuffer(int bufferSize)
public final void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic final void write(@Nonnull
byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic final int write(java.nio.ByteBuffer src)
throws java.io.IOException
write in interface java.nio.channels.WritableByteChannelwrite in class OutputStreamChanneljava.io.IOExceptionpublic final void writeInt(int v)
throws java.io.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.java.io.IOException - if an I/O error occurs.DataOutput.writeInt(int)public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic final boolean isOpen()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in class java.io.OutputStreamjava.io.IOExceptionprotected void flushBufferBlocking(java.nio.ByteBuffer buffer)
throws java.io.IOException
java.io.IOExceptionCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.