public class PacketWritestream extends Object implements WriteStream<Buffer>
WriteStream
for sending packets to a SocketAddress
.
The stream is called when the write fails.
NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static TypeArg<PacketWritestream> |
__TYPE_ARG |
Constructor and Description |
---|
PacketWritestream(PacketWritestream delegate) |
Modifier and Type | Method and Description |
---|---|
PacketWritestream |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
void |
end()
Ends the stream.
|
void |
end(Buffer t)
Same as
WriteStream.end() but writes some data to the stream before ending. |
PacketWritestream |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
PacketWritestream |
getDelegate() |
static PacketWritestream |
newInstance(PacketWritestream arg) |
PacketWritestream |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
PacketWritestream |
write(Buffer data)
Write some data to the stream.
|
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newInstance, newInstance
newInstance
public static final TypeArg<PacketWritestream> __TYPE_ARG
public PacketWritestream(PacketWritestream delegate)
public PacketWritestream getDelegate()
getDelegate
in interface StreamBase
getDelegate
in interface WriteStream<Buffer>
public void end()
Once the stream has ended, it cannot be used any more.
end
in interface WriteStream<Buffer>
public void end(Buffer t)
WriteStream.end()
but writes some data to the stream before ending.end
in interface WriteStream<Buffer>
t
- public boolean writeQueueFull()
true
if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)
writeQueueFull
in interface WriteStream<Buffer>
public PacketWritestream exceptionHandler(Handler<Throwable> handler)
WriteStream
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<Buffer>
handler
- the exception handlerpublic PacketWritestream write(Buffer data)
WriteStream
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a Pump
.write
in interface WriteStream<Buffer>
data
- the data to writepublic PacketWritestream setWriteQueueMaxSize(int maxSize)
WriteStream
maxSize
. You will still be able to write to the stream even
if there is more than maxSize
items in the write queue. This is used as an indicator by classes such as
Pump
to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket
, the number of Message
for a
MessageProducer
, etc...setWriteQueueMaxSize
in interface WriteStream<Buffer>
maxSize
- the max size of the write streampublic PacketWritestream drainHandler(Handler<Void> handler)
WriteStream
Pump
for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2
.drainHandler
in interface WriteStream<Buffer>
handler
- the handlerpublic static PacketWritestream newInstance(PacketWritestream arg)
Copyright © 2017. All rights reserved.