org.xnio.conduits.Conduit, org.xnio.conduits.SourceConduit, org.xnio.conduits.StreamSourceConduitpublic 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 | 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 | Description |
|---|---|---|
void |
awaitReadable() |
|
void |
awaitReadable(long time,
java.util.concurrent.TimeUnit timeUnit) |
|
long |
getRemaining() |
Get the number of remaining bytes.
|
boolean |
isReadResumed() |
|
int |
read(java.nio.ByteBuffer dst) |
|
long |
read(java.nio.ByteBuffer[] dsts) |
|
long |
read(java.nio.ByteBuffer[] dsts,
int offset,
int length) |
|
void |
terminateReads() |
|
long |
transferTo(long position,
long count,
java.nio.channels.FileChannel target) |
|
long |
transferTo(long count,
java.nio.ByteBuffer throughBuffer,
org.xnio.channels.StreamSinkChannel target) |
|
void |
wakeupReads() |
getReadThread, isReadShutdown, resumeReads, setReadReadyHandler, suspendReadspublic 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,
java.nio.channels.FileChannel target)
throws java.io.IOException
transferTo in interface org.xnio.conduits.StreamSourceConduittransferTo in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic long transferTo(long count,
java.nio.ByteBuffer throughBuffer,
org.xnio.channels.StreamSinkChannel target)
throws java.io.IOException
transferTo in interface org.xnio.conduits.StreamSourceConduittransferTo in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic long read(java.nio.ByteBuffer[] dsts,
int offset,
int length)
throws java.io.IOException
read in interface org.xnio.conduits.StreamSourceConduitread in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic long read(java.nio.ByteBuffer[] dsts)
throws java.io.IOException
java.io.IOExceptionpublic int read(java.nio.ByteBuffer dst)
throws java.io.IOException
read in interface org.xnio.conduits.StreamSourceConduitread in class org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic boolean isReadResumed()
isReadResumed in interface org.xnio.conduits.SourceConduitisReadResumed in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>public void wakeupReads()
wakeupReads in interface org.xnio.conduits.SourceConduitwakeupReads in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>public void terminateReads()
throws java.io.IOException
terminateReads in interface org.xnio.conduits.SourceConduitterminateReads in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic void awaitReadable()
throws java.io.IOException
awaitReadable in interface org.xnio.conduits.SourceConduitawaitReadable in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic void awaitReadable(long time,
java.util.concurrent.TimeUnit timeUnit)
throws java.io.IOException
awaitReadable in interface org.xnio.conduits.SourceConduitawaitReadable in class org.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>java.io.IOExceptionpublic long getRemaining()
Copyright © 2018. All rights reserved.