-
- All Superinterfaces:
Conduit
,SourceConduit
- All Known Implementing Classes:
AbstractStreamSourceConduit
,BlockingStreamSourceConduit
,BufferedStreamSourceConduit
,EmptyStreamSourceConduit
,FixedLengthStreamSourceConduit
,InflatingStreamSourceConduit
,MessageStreamSourceConduit
,PushBackStreamSourceConduit
,StreamSourceChannelWrappingConduit
,SynchronizedStreamSourceConduit
public interface StreamSourceConduit extends SourceConduit
- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
read(java.nio.ByteBuffer dst)
Read a sequence of bytes from this conduit to the given buffer.long
read(java.nio.ByteBuffer[] dsts, int offs, int len)
Read a sequence of bytes from this conduit to the given buffers.long
transferTo(long position, long count, java.nio.channels.FileChannel target)
Transfers bytes into the given file from this channel.long
transferTo(long count, java.nio.ByteBuffer throughBuffer, StreamSinkChannel target)
Transfers bytes into the given channel target.-
Methods inherited from interface org.xnio.conduits.SourceConduit
awaitReadable, awaitReadable, getReadThread, isReadResumed, isReadShutdown, resumeReads, setReadReadyHandler, suspendReads, terminateReads, wakeupReads
-
-
-
-
Method Detail
-
transferTo
long transferTo(long position, long count, java.nio.channels.FileChannel target) throws java.io.IOException
Transfers bytes into the given file from this channel.- Parameters:
position
- the position within the file from which the transfer is to begincount
- the number of bytes to be transferredtarget
- the file to write to- Returns:
- the number of bytes (possibly 0) that were actually transferred
- Throws:
java.io.IOException
- if an I/O error occurs
-
transferTo
long transferTo(long count, java.nio.ByteBuffer throughBuffer, StreamSinkChannel target) throws java.io.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 thancount
, then the remaining data inthroughBuffer
may contain data read from this channel which must be written totarget
to complete the operation.- Parameters:
count
- the number of bytes to be transferredthroughBuffer
- the buffer to copy through.target
- the destination to write to- Returns:
- the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached
- Throws:
java.io.IOException
- if an I/O error occurs
-
read
int read(java.nio.ByteBuffer dst) throws java.io.IOException
Read a sequence of bytes from this conduit to the given buffer.- Parameters:
src
- the buffer to fill with data from the conduit- Returns:
- the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or
this conduit's
SourceConduit.terminateReads()
method was previously called - Throws:
java.io.IOException
- if an error occurs
-
read
long read(java.nio.ByteBuffer[] dsts, int offs, int len) throws java.io.IOException
Read a sequence of bytes from this conduit to the given buffers.- Parameters:
srcs
- the buffers to fill with data from the conduitoffs
- the offset into the buffer arraylen
- the number of buffers to fill- Returns:
- the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or
this conduit's
SourceConduit.terminateReads()
method was previously called - Throws:
java.io.IOException
- if an error occurs
-
-