Top Methods
org.xnio.conduits

public Interface StreamSourceConduit

extends SourceConduit
Known Direct Implementers
org.xnio.conduits.SynchronizedStreamSourceConduit, org.xnio.ssl.JsseStreamConduit, org.xnio.conduits.AbstractStreamSourceConduit, org.xnio.conduits.EmptyStreamSourceConduit, org.xnio.conduits.FixedLengthStreamSourceConduit, org.xnio.conduits.InflatingStreamSourceConduit, org.xnio.conduits.MessageStreamSourceConduit, org.xnio.conduits.PushBackStreamSourceConduit, org.xnio.conduits.PushBackStreamSourceConduit.BufferConduit, org.xnio.conduits.StreamSourceChannelWrappingConduit
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.FileChannel, org.xnio.channels.StreamSinkChannel

Author
David M. Lloyd

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called
read
(ByteBuffer
the buffer to fill with data from the conduit
dst
)

Read a sequence of bytes from this conduit to the given buffer.

public long

Returns:

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called
read
(ByteBuffer[]
the buffers to fill with data from the conduit
dsts
,
int
the offset into the buffer array
offs
,
int
the number of buffers to fill
len
)

Read a sequence of bytes from this conduit to the given buffers.

public long

Returns:

the number of bytes (possibly 0) that were actually transferred
transferTo
(long
the position within the file from which the transfer is to begin
position
,
long
the number of bytes to be transferred
count
,
FileChannel
the file to write to
target
)

Transfers bytes into the given file from this channel.

public long

Returns:

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached
transferTo
(long
the number of bytes to be transferred
count
,
ByteBuffer
the buffer to copy through.
throughBuffer
,
StreamSinkChannel
the destination to write to
target
)

Transfers bytes into the given channel target.

Inherited from org.xnio.conduits.SourceConduit:
awaitReadableawaitReadablegetReadThreadisReadResumedisReadShutdownresumeReadssetReadReadyHandlersuspendReadsterminateReadswakeupReads

Method Detail

readback to summary
public int read(ByteBuffer dst) throws IOException

Read a sequence of bytes from this conduit to the given buffer.

Parameters
dst:ByteBuffer

the buffer to fill with data from the conduit

Returns:int

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called

Exceptions
IOException:
if an error occurs
readback to summary
public long read(ByteBuffer[] dsts, int offs, int len) throws IOException

Read a sequence of bytes from this conduit to the given buffers.

Parameters
dsts:ByteBuffer[]

the buffers to fill with data from the conduit

offs:int

the offset into the buffer array

len:int

the number of buffers to fill

Returns:long

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called

Exceptions
IOException:
if an error occurs
transferToback to summary
public long transferTo(long position, long count, FileChannel target) throws IOException

Transfers bytes into the given file from this channel.

Parameters
position:long

the position within the file from which the transfer is to begin

count:long

the number of bytes to be transferred

target:FileChannel

the file to write to

Returns:long

the number of bytes (possibly 0) that were actually transferred

Exceptions
IOException:
if an I/O error occurs
transferToback to summary
public long transferTo(long count, ByteBuffer throughBuffer, StreamSinkChannel target) throws IOException

Transfers bytes into the given channel target. On entry, throughBuffer will be cleared. On exit, the buffer will be flipped for emptying, and may possibly 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 this channel which must be written to target to complete the operation.

Parameters
count:long

the number of bytes to be transferred

throughBuffer:ByteBuffer

the buffer to copy through.

target:StreamSinkChannel

the destination to write to

Returns:long

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached

Exceptions
IOException:
if an I/O error occurs