
public final class FixedLengthStreamSinkConduit extends AbstractStreamSinkConduit<StreamSinkConduit> implements StreamSinkConduit
next| Constructor and Description |
|---|
FixedLengthStreamSinkConduit(FixedLengthStreamSinkConduit next)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getRemaining()
Get the number of remaining bytes available to read.
|
void |
terminateWrites()
Signal that no more write data is forthcoming.
|
long |
transferFrom(FileChannel src,
long position,
long count)
Transfer bytes into this conduit from the given file.
|
long |
transferFrom(StreamSourceChannel source,
long count,
ByteBuffer throughBuffer)
Transfers bytes from the given channel source.
|
void |
truncateWrites()
Terminate writes and discard any outstanding write data.
|
int |
write(ByteBuffer src)
Writes a sequence of bytes to this conduit from the given buffer.
|
long |
write(ByteBuffer[] srcs,
int offs,
int len)
Writes a sequence of bytes to this conduit from the given buffers.
|
awaitWritable, awaitWritable, flush, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWritesgetWorkerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawaitWritable, awaitWritable, flush, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWritespublic FixedLengthStreamSinkConduit(FixedLengthStreamSinkConduit next)
next - the delegate conduit to setpublic long transferFrom(FileChannel src, long position, long count) throws IOException
StreamSinkConduittransferFrom in interface StreamSinkConduittransferFrom in class AbstractStreamSinkConduit<StreamSinkConduit>src - the file to read fromposition - the position within the file from which the transfer is to begincount - the number of bytes to be transferredIOException - if an I/O error occurspublic long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException
StreamSinkConduitthroughBuffer will be cleared. On exit, the
buffer will be flipped for emptying, and may be empty or may contain data. If this method returns a value less
than count, then the remaining data in throughBuffer may contain data read from source
which must be written to this channel to complete the operation.transferFrom in interface StreamSinkConduittransferFrom in class AbstractStreamSinkConduit<StreamSinkConduit>source - the source to read fromcount - the number of bytes to be transferredthroughBuffer - the buffer to copy through.IOException - if an I/O error occurspublic int write(ByteBuffer src) throws IOException
StreamSinkConduitwrite in interface StreamSinkConduitwrite in class AbstractStreamSinkConduit<StreamSinkConduit>src - the buffer containing data to writeClosedChannelException - if this conduit's SinkConduit.terminateWrites() method was previously calledIOException - if an error occurspublic long write(ByteBuffer[] srcs, int offs, int len) throws IOException
StreamSinkConduitwrite in interface StreamSinkConduitwrite in class AbstractStreamSinkConduit<StreamSinkConduit>srcs - the buffers containing data to writeoffs - the offset into the buffer arraylen - the number of buffers to writeClosedChannelException - if this conduit's SinkConduit.terminateWrites() method was previously calledIOException - if an error occurspublic void terminateWrites()
throws IOException
SinkConduitSinkConduit.flush()ed before it is considered
to be shut down.terminateWrites in interface SinkConduitterminateWrites in class AbstractSinkConduit<StreamSinkConduit>IOExceptionpublic void truncateWrites()
throws IOException
SinkConduittruncateWrites in interface SinkConduittruncateWrites in class AbstractSinkConduit<StreamSinkConduit>IOException - if channel termination failed for some reasonpublic long getRemaining()
Copyright © 2010 JBoss, a division of Red Hat, Inc.