public final class FixedLengthStreamSourceConduit
extends org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>
getRemaining()
to see if more bytes were pending when the channel was closed.Constructor and Description |
---|
FixedLengthStreamSourceConduit(org.xnio.conduits.StreamSourceConduit next, long contentLength, ConduitListener<? super FixedLengthStreamSourceConduit> finishListener) Construct a new instance. |
FixedLengthStreamSourceConduit(org.xnio.conduits.StreamSourceConduit next, long contentLength, ConduitListener<? super FixedLengthStreamSourceConduit> finishListener, HttpServerExchange exchange) Construct a new instance. |
Modifier and Type | Method and Description |
---|---|
void | awaitReadable() |
void | awaitReadable(long time, TimeUnit timeUnit) |
long | getRemaining() Get the number of remaining bytes. |
boolean | isReadResumed() |
int | read(ByteBuffer dst) |
long | read(ByteBuffer[] dsts) |
long | read(ByteBuffer[] dsts, int offset, int length) |
void | terminateReads() |
long | transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target) |
long | transferTo(long position, long count, FileChannel target) |
void | wakeupReads() |
getReadThread, isReadShutdown, resumeReads, setReadReadyHandler, suspendReads
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FixedLengthStreamSourceConduit(org.xnio.conduits.StreamSourceConduit next, long contentLength, ConduitListener<? super FixedLengthStreamSourceConduit> finishListener, HttpServerExchange exchange)
Calling this constructor will replace the read listener of the underlying channel. The listener should be restored from the finishListener
object. The underlying stream should not be closed while this wrapper stream is active.
next
- the stream source channel to read fromcontentLength
- the amount of content to readfinishListener
- the listener to call once the stream is exhausted or closedexchange
- The server exchange. This is used to determine the max sizepublic FixedLengthStreamSourceConduit(org.xnio.conduits.StreamSourceConduit next, long contentLength, ConduitListener<? super FixedLengthStreamSourceConduit> finishListener)
Calling this constructor will replace the read listener of the underlying channel. The listener should be restored from the finishListener
object. The underlying stream should not be closed while this wrapper stream is active.
next
- the stream source channel to read fromcontentLength
- the amount of content to readfinishListener
- the listener to call once the stream is exhausted or closedpublic long transferTo(long position, long count, FileChannel target) throws IOException
transferTo
in interface org.xnio.conduits.StreamSourceConduit
transferTo
in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public long transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target) throws IOException
transferTo
in interface org.xnio.conduits.StreamSourceConduit
transferTo
in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
read
in interface org.xnio.conduits.StreamSourceConduit
read
in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public long read(ByteBuffer[] dsts) throws IOException
IOException
public int read(ByteBuffer dst) throws IOException
read
in interface org.xnio.conduits.StreamSourceConduit
read
in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public boolean isReadResumed()
isReadResumed
in interface org.xnio.conduits.SourceConduit
isReadResumed
in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>
public void wakeupReads()
wakeupReads
in interface org.xnio.conduits.SourceConduit
wakeupReads
in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>
public void terminateReads() throws IOException
terminateReads
in interface org.xnio.conduits.SourceConduit
terminateReads
in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public void awaitReadable() throws IOException
awaitReadable
in interface org.xnio.conduits.SourceConduit
awaitReadable
in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public void awaitReadable(long time, TimeUnit timeUnit) throws IOException
awaitReadable
in interface org.xnio.conduits.SourceConduit
awaitReadable
in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>
IOException
public long getRemaining()
Copyright © 2020 JBoss by Red Hat. All rights reserved.