io.vertx.core.datagram

## Interface PacketWritestream

- All Superinterfaces:
    StreamBase, WriteStream<Buffer>

      public interface PacketWritestream
      extends WriteStream<Buffer>

  A `WriteStream` for sending packets to a `SocketAddress`. The stream `WriteStream.exceptionHandler(io.vertx.core.Handler<java.lang.Throwable>)` is called when the write fails.
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `PacketWritestream` | `drainHandler(Handler<Void> handler)` Set a drain handler on the stream.
    `PacketWritestream` | `exceptionHandler(Handler<Throwable> handler)` Set an exception handler on the write stream.
    `PacketWritestream` | `setWriteQueueMaxSize(int maxSize)` Set the maximum size of the write queue to `maxSize`.
    `PacketWritestream` | `write(Buffer data)` Write some data to the stream.

    - ### Methods inherited from interface io.vertx.core.streams.WriteStream

      `end, end, writeQueueFull`

- - ### Method Detail

    - #### exceptionHandler

          PacketWritestream exceptionHandler(Handler<Throwable> handler)

      Description copied from interface: `WriteStream`
      Set an exception handler on the write stream.
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Specified by:
        `exceptionHandler` in interface `WriteStream<Buffer>`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### write

          PacketWritestream write(Buffer data)

      Description copied from interface: `WriteStream`
      Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the `WriteStream.writeQueueFull()` method before writing. This is done automatically if using a `Pump`.
      Specified by:
        `write` in interface `WriteStream<Buffer>`
      Parameters:
        `data` - the data to write
      Returns:
        a reference to this, so the API can be used fluently

    - #### setWriteQueueMaxSize

          PacketWritestream setWriteQueueMaxSize(int maxSize)

      Description copied from interface: `WriteStream`
      Set the maximum size of the write queue to `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...
      Specified by:
        `setWriteQueueMaxSize` in interface `WriteStream<Buffer>`
      Parameters:
        `maxSize` - the max size of the write stream
      Returns:
        a reference to this, so the API can be used fluently

    - #### drainHandler

          PacketWritestream drainHandler(Handler<Void> handler)

      Description copied from interface: `WriteStream`
      Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See `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`.
      Specified by:
        `drainHandler` in interface `WriteStream<Buffer>`
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

Copyright © 2016. All rights reserved.