public abstract class OutputStreamChannel extends OutputStream implements WritableByteChannel, Closeable
| Modifier and Type | Field and Description |
|---|---|
protected long |
bytesWritten |
protected WritableByteChannel |
channel |
protected static long |
PARK_NANOS_MAX
Maximum nanos to park reader thread to wait for writing data in
non-blocking mode (if selector is present then it will explicitly signal)
|
protected Thread |
parkedThread |
| Modifier | Constructor and Description |
|---|---|
protected |
OutputStreamChannel(WritableByteChannel channel) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
flushBufferNonBlockingBase(ByteBuffer buffer) |
long |
getBytesWritten() |
Thread |
getParkedThread() |
protected long |
getParkNanosMax() |
WritableByteChannel |
getUnderlyingChannel()
Get the underlying
WritableByteChannel. |
abstract int |
write(ByteBuffer src) |
protected int |
writeBuffer(ByteBuffer buffer,
WritableByteChannel channel) |
protected int |
writeBuffered(ByteBuffer src,
ByteBuffer channelBuffer)
Common base method to write a given ByteBuffer source via an intermediate
direct byte buffer owned by the implementation of this class (if required).
|
protected int |
writeBufferNonBlocking(ByteBuffer buffer,
WritableByteChannel channel) |
abstract 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). |
protected final WritableByteChannel channel
protected volatile Thread parkedThread
protected volatile long bytesWritten
protected static final long PARK_NANOS_MAX
protected OutputStreamChannel(WritableByteChannel channel)
public final WritableByteChannel getUnderlyingChannel()
WritableByteChannel.public abstract int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic abstract 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).v - the int value to be written.IOException - if an I/O error occurs.DataOutput.writeInt(int)protected final int writeBuffered(ByteBuffer src, ByteBuffer channelBuffer) throws IOException
IOExceptionprotected final boolean flushBufferNonBlockingBase(ByteBuffer buffer) throws IOException
IOExceptionprotected int writeBuffer(ByteBuffer buffer, WritableByteChannel channel) throws IOException
IOExceptionprotected long getParkNanosMax()
protected int writeBufferNonBlocking(ByteBuffer buffer, WritableByteChannel channel) throws IOException
IOExceptionpublic final Thread getParkedThread()
public final long getBytesWritten()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.