Class QuicStream

java.lang.Object
io.vertx.rxjava3.core.net.QuicStream
All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate, StreamChannel, ReadStream<Buffer>, StreamBase, WriteStream<Buffer>

public class QuicStream extends Object implements io.vertx.lang.rx.RxDelegate, StreamChannel
A Quic stream.

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.

  • Field Details

    • __TYPE_ARG

      public static final io.vertx.lang.rx.TypeArg<QuicStream> __TYPE_ARG
  • Constructor Details

    • QuicStream

      public QuicStream(QuicStream delegate)
    • QuicStream

      public QuicStream(Object delegate)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDelegate

      public QuicStream getDelegate()
      Specified by:
      getDelegate in interface ReadStream<Buffer>
      Specified by:
      getDelegate in interface io.vertx.lang.rx.RxDelegate
      Specified by:
      getDelegate in interface StreamBase
      Specified by:
      getDelegate in interface StreamChannel
      Specified by:
      getDelegate in interface WriteStream<Buffer>
    • toObservable

      public Observable<Buffer> toObservable()
      Specified by:
      toObservable in interface ReadStream<Buffer>
    • toFlowable

      public Flowable<Buffer> toFlowable()
      Specified by:
      toFlowable in interface ReadStream<Buffer>
    • toObserver

      public WriteStreamObserver<Buffer> toObserver()
      Specified by:
      toObserver in interface WriteStream<Buffer>
    • toSubscriber

      public WriteStreamSubscriber<Buffer> toSubscriber()
      Specified by:
      toSubscriber in interface WriteStream<Buffer>
    • pipe

      public Pipe<Buffer> pipe()
      Pause this stream and return a to transfer the elements of this stream to a destination .

      The stream will be resumed when the pipe will be wired to a WriteStream.

      Specified by:
      pipe in interface ReadStream<Buffer>
      Specified by:
      pipe in interface StreamChannel
      Returns:
      a pipe
    • pipeTo

      public Completable pipeTo(WriteStream<Buffer> dst)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Specified by:
      pipeTo in interface ReadStream<Buffer>
      Specified by:
      pipeTo in interface StreamChannel
      Parameters:
      dst - the destination write stream
      Returns:
      a future notified when the write stream will be ended with the outcome
    • rxPipeTo

      public Completable rxPipeTo(WriteStream<Buffer> dst)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Specified by:
      rxPipeTo in interface ReadStream<Buffer>
      Specified by:
      rxPipeTo in interface StreamChannel
      Parameters:
      dst - the destination write stream
      Returns:
      a future notified when the write stream will be ended with the outcome
    • write

      public Completable write(Buffer data)
      Write some data to the stream.

      The data is usually 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 .

      When the data is moved from the queue to the actual medium, the returned will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.

      Specified by:
      write in interface StreamChannel
      Specified by:
      write in interface WriteStream<Buffer>
      Parameters:
      data - the data to write
      Returns:
      a future completed with the write result
    • rxWrite

      public Completable rxWrite(Buffer data)
      Write some data to the stream.

      The data is usually 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 .

      When the data is moved from the queue to the actual medium, the returned will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.

      Specified by:
      rxWrite in interface StreamChannel
      Specified by:
      rxWrite in interface WriteStream<Buffer>
      Parameters:
      data - the data to write
      Returns:
      a future completed with the write result
    • end

      public Completable end(Buffer data)
      Same as StreamChannel.end(Buffer) but writes some data to the stream before ending.
      Specified by:
      end in interface StreamChannel
      Specified by:
      end in interface WriteStream<Buffer>
      Parameters:
      data - the data to write
      Returns:
      a future completed with the result
    • rxEnd

      public Completable rxEnd(Buffer data)
      Same as StreamChannel.end(Buffer) but writes some data to the stream before ending.
      Specified by:
      rxEnd in interface StreamChannel
      Specified by:
      rxEnd in interface WriteStream<Buffer>
      Parameters:
      data - the data to write
      Returns:
      a future completed with the result
    • writeQueueFull

      public boolean writeQueueFull()
      This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)
      Specified by:
      writeQueueFull in interface StreamChannel
      Specified by:
      writeQueueFull in interface WriteStream<Buffer>
      Returns:
      true if write queue is full
    • write

      public Completable write(String str)
      Write a String to the connection, encoded in UTF-8.
      Specified by:
      write in interface StreamChannel
      Parameters:
      str - the string to write
      Returns:
      a future result of the write
    • rxWrite

      public Completable rxWrite(String str)
      Write a String to the connection, encoded in UTF-8.
      Specified by:
      rxWrite in interface StreamChannel
      Parameters:
      str - the string to write
      Returns:
      a future result of the write
    • write

      public Completable write(String str, String enc)
      Write a String to the connection, encoded using the encoding enc.
      Specified by:
      write in interface StreamChannel
      Parameters:
      str - the string to write
      enc - the encoding to use
      Returns:
      a future completed with the result
    • rxWrite

      public Completable rxWrite(String str, String enc)
      Write a String to the connection, encoded using the encoding enc.
      Specified by:
      rxWrite in interface StreamChannel
      Parameters:
      str - the string to write
      enc - the encoding to use
      Returns:
      a future completed with the result
    • sendFile

      public Completable sendFile(String filename)
      Tell the operating system to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files.
      Specified by:
      sendFile in interface StreamChannel
      Parameters:
      filename - file name of the file to send
      Returns:
      a future result of the send operation
    • rxSendFile

      public Completable rxSendFile(String filename)
      Tell the operating system to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files.
      Specified by:
      rxSendFile in interface StreamChannel
      Parameters:
      filename - file name of the file to send
      Returns:
      a future result of the send operation
    • sendFile

      public Completable sendFile(String filename, long offset)
      Tell the operating system to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files.
      Specified by:
      sendFile in interface StreamChannel
      Parameters:
      filename - file name of the file to send
      offset - offset
      Returns:
      a future result of the send operation
    • rxSendFile

      public Completable rxSendFile(String filename, long offset)
      Tell the operating system to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files.
      Specified by:
      rxSendFile in interface StreamChannel
      Parameters:
      filename - file name of the file to send
      offset - offset
      Returns:
      a future result of the send operation
    • sendFile

      public Completable sendFile(String filename, long offset, long length)
      Tell the operating system to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files.
      Specified by:
      sendFile in interface StreamChannel
      Parameters:
      filename - file name of the file to send
      offset - offset
      length - length
      Returns:
      a future result of the send operation
    • rxSendFile

      public Completable rxSendFile(String filename, long offset, long length)
      Tell the operating system to stream a file as specified by filename directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files.
      Specified by:
      rxSendFile in interface StreamChannel
      Parameters:
      filename - file name of the file to send
      offset - offset
      length - length
      Returns:
      a future result of the send operation
    • end

      public Completable end()
      Specified by:
      end in interface StreamChannel
      Specified by:
      end in interface WriteStream<Buffer>
      Returns:
      a future completed with the result
    • rxEnd

      public Completable rxEnd()
      Specified by:
      rxEnd in interface StreamChannel
      Specified by:
      rxEnd in interface WriteStream<Buffer>
      Returns:
      a future completed with the result
    • close

      public Completable close()
      Close the channel
      Specified by:
      close in interface StreamChannel
      Returns:
      a future completed with the result
    • rxClose

      public Completable rxClose()
      Close the channel
      Specified by:
      rxClose in interface StreamChannel
      Returns:
      a future completed with the result
    • id

      public long id()
    • isBidirectional

      public boolean isBidirectional()
      Returns:
      whether the stream is unidirectional or bidirectional
    • isLocalCreated

      public boolean isLocalCreated()
      Returns:
      whether the stream was created by this connection
    • connection

      public QuicConnection connection()
      Returns:
      the Quic connection this streams belongs to
    • resetHandler

      public QuicStream resetHandler(Handler<Long> handler)

      Set a handler called upon stream reset: when a stream receives a reset frame from its peer, this handler is called.

      When no such handler is set, the stream exception handler is called and then the stream is automatically closed. Setting this handler changes this behavior: the handler processes the reset event and the handler has the full responsibility of managing the stream. That means the sending part of this stream is left untouched and the application can continue sending data.

      Parameters:
      handler - the handler
      Returns:
      this instance of a stream
    • reset

      public Completable reset(int error)
      Abruptly terminate the sending part of the stream with the specified application protocol error code argument, a RESET frame is sent to the remote peer.
      Parameters:
      error - the application protocol error code
      Returns:
      a future completed when the reset frame has been sent
    • rxReset

      public Completable rxReset(int error)
      Abruptly terminate the sending part of the stream with the specified application protocol error code argument, a RESET frame is sent to the remote peer.
      Parameters:
      error - the application protocol error code
      Returns:
      a future completed when the reset frame has been sent
    • abort

      public Completable abort(int error)
      Instruct the remote peer that this part of the stream is no longer interested in received data and wants it to cease transmission, a STOP_SENDING frame is sent to the remote peer.
      Parameters:
      error - the error code
      Returns:
      a future completed when the STOP_SENDING frame has been sent
    • rxAbort

      public Completable rxAbort(int error)
      Instruct the remote peer that this part of the stream is no longer interested in received data and wants it to cease transmission, a STOP_SENDING frame is sent to the remote peer.
      Parameters:
      error - the error code
      Returns:
      a future completed when the STOP_SENDING frame has been sent
    • closeHandler

      public QuicStream closeHandler(Handler<Void> handler)
      Set a handler called when the stream is closed.
      Specified by:
      closeHandler in interface StreamChannel
      Parameters:
      handler - the handler signaled with the stream close
      Returns:
      this instance of a stream
    • shutdownHandler

      public QuicStream shutdownHandler(Handler<Duration> handler)
      Set a handler called when the stream is shutdown or closed
      Parameters:
      handler - the handler signaled with the stream shutdown
      Returns:
      this instance of a stream
    • exceptionHandler

      public QuicStream exceptionHandler(Handler<Throwable> handler)
      Set an exception handling, catching stream exceptions.
      Specified by:
      exceptionHandler in interface ReadStream<Buffer>
      Specified by:
      exceptionHandler in interface StreamBase
      Specified by:
      exceptionHandler in interface StreamChannel
      Specified by:
      exceptionHandler in interface WriteStream<Buffer>
      Parameters:
      handler - the exception handler
      Returns:
      this instance of a stream
    • handler

      public QuicStream handler(Handler<Buffer> handler)
      Set the handler signaled with the data events the remote peer has sent.
      Specified by:
      handler in interface ReadStream<Buffer>
      Specified by:
      handler in interface StreamChannel
      Parameters:
      handler - the data event handler
      Returns:
      this instance of a stream
    • pause

      public QuicStream pause()
      Description copied from interface: ReadStream
      Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

      While it's paused, no data will be sent to the data handler.

      Specified by:
      pause in interface ReadStream<Buffer>
      Specified by:
      pause in interface StreamChannel
      Returns:
      a reference to this, so the API can be used fluently
    • resume

      public QuicStream resume()
      Description copied from interface: ReadStream
      Resume reading, and sets the buffer in flowing mode.

      If the ReadStream has been paused, reading will recommence on it.

      Specified by:
      resume in interface ReadStream<Buffer>
      Specified by:
      resume in interface StreamChannel
      Returns:
      a reference to this, so the API can be used fluently
    • fetch

      public QuicStream fetch(long amount)
      Description copied from interface: ReadStream
      Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.
      Specified by:
      fetch in interface ReadStream<Buffer>
      Specified by:
      fetch in interface StreamChannel
      Parameters:
      amount -
      Returns:
      a reference to this, so the API can be used fluently
    • endHandler

      public QuicStream endHandler(Handler<Void> endHandler)
      Description copied from interface: StreamChannel

      This handler might be called after the close handler when the channel is paused and there are still buffers to deliver.

      Specified by:
      endHandler in interface ReadStream<Buffer>
      Specified by:
      endHandler in interface StreamChannel
      Parameters:
      endHandler -
      Returns:
    • setWriteQueueMaxSize

      public QuicStream 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 Pipe to provide flow control.

      The value is defined by the implementation of the stream, e.g in bytes for a NetSocket, etc...

      Specified by:
      setWriteQueueMaxSize in interface StreamChannel
      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

      public QuicStream 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 Pipe 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 StreamChannel
      Specified by:
      drainHandler in interface WriteStream<Buffer>
      Parameters:
      handler - the handler
      Returns:
      a reference to this, so the API can be used fluently
    • newInstance

      public static QuicStream newInstance(QuicStream arg)