Interface Stream

    • Method Detail

      • openAsync

        void openAsync(AsyncCompletionHandler<Void> handler)
        Open the stream asynchronously.
        Parameters:
        handler - the completion handler for opening the stream
      • write

        void write(List<ByteBuf> buffers)
            throws IOException
        Write each buffer in the list to the stream in order, blocking until all are completely written.
        Parameters:
        buffers - the buffers to write
        Throws:
        IOException - if there are problems writing to the stream
      • read

        ByteBuf read(int numBytes)
              throws IOException
        Read from the stream, blocking until the requested number of bytes have been read.
        Parameters:
        numBytes - The number of bytes to read into the returned byte buffer
        Returns:
        a byte buffer filled with number of bytes requested
        Throws:
        IOException - if there are problems reading from the stream
      • writeAsync

        void writeAsync(List<ByteBuf> buffers,
                        AsyncCompletionHandler<Void> handler)
        Write each buffer in the list to the stream in order, asynchronously. This method should return immediately, and invoke the given callback on completion.
        Parameters:
        buffers - the buffers to write
        handler - invoked when the read operation has completed
      • readAsync

        void readAsync(int numBytes,
                       AsyncCompletionHandler<ByteBuf> handler)
        Read from the stream, asynchronously. This method should return immediately, and invoke the given callback when the number of requested bytes have been read.
        Parameters:
        numBytes - the number of bytes
        handler - invoked when the read operation has completed
      • getAddress

        ServerAddress getAddress()
        The address that this stream is connected to.
        Returns:
        the address
      • close

        void close()
        Closes the connection.
      • isClosed

        boolean isClosed()
        Returns the closed state of the connection
        Returns:
        true if connection is closed