public class RateLimitingStreamSinkConduit
extends org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
Allows send speed to be throttled
Note that throttling is applied after an initial write, so if a big write is performed initially it may be a while before it can write again.
| Constructor | Description |
|---|---|
RateLimitingStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next,
int bytes,
long time,
TimeUnit timeUnit) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
awaitWritable() |
|
void |
awaitWritable(long time,
TimeUnit timeUnit) |
|
boolean |
isWriteResumed() |
|
void |
resumeWrites() |
|
void |
suspendWrites() |
|
long |
transferFrom(FileChannel src,
long position,
long count) |
|
long |
transferFrom(org.xnio.channels.StreamSourceChannel source,
long count,
ByteBuffer throughBuffer) |
|
void |
wakeupWrites() |
|
int |
write(ByteBuffer src) |
|
long |
write(ByteBuffer[] srcs,
int offs,
int len) |
|
int |
writeFinal(ByteBuffer src) |
|
long |
writeFinal(ByteBuffer[] srcs,
int offs,
int len) |
flush, getWriteThread, isWriteShutdown, setWriteReadyHandler, terminateWrites, truncateWritespublic RateLimitingStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next,
int bytes,
long time,
TimeUnit timeUnit)
next - The next conduitbytes - The number of bytes that are allowed per time frametime - The time frametimeUnit - The time unitpublic int write(ByteBuffer src) throws IOException
write in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic long transferFrom(FileChannel src, long position, long count) throws IOException
transferFrom in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic long transferFrom(org.xnio.channels.StreamSourceChannel source,
long count,
ByteBuffer throughBuffer)
throws IOException
transferFrom in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic long write(ByteBuffer[] srcs, int offs, int len) throws IOException
write in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic int writeFinal(ByteBuffer src) throws IOException
writeFinal in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic long writeFinal(ByteBuffer[] srcs, int offs, int len) throws IOException
writeFinal in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic void resumeWrites()
resumeWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>public void suspendWrites()
suspendWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>public void wakeupWrites()
wakeupWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>public boolean isWriteResumed()
isWriteResumed in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>public void awaitWritable()
throws IOException
awaitWritable in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionpublic void awaitWritable(long time,
TimeUnit timeUnit)
throws IOException
awaitWritable in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>IOExceptionCopyright © 2018. All rights reserved.