Interface Stream

All Superinterfaces:
BufferProvider

@Deprecated public interface Stream extends BufferProvider
Deprecated.
There is no replacement for this interface.
A full duplex stream of bytes.
Since:
3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Closes the connection.
    Deprecated.
    The address that this stream is connected to.
    boolean
    Deprecated.
    Returns the closed state of the connection
    void
    Deprecated.
    Open the stream.
    void
    Deprecated.
    Open the stream asynchronously.
    read(int numBytes)
    Deprecated.
    Read from the stream, blocking until the requested number of bytes have been read.
    default ByteBuf
    read(int numBytes, int additionalTimeout)
    Deprecated.
    Read from the stream, blocking until the requested number of bytes have been read.
    void
    readAsync(int numBytes, AsyncCompletionHandler<ByteBuf> handler)
    Deprecated.
    Read from the stream, asynchronously.
    default boolean
    Deprecated.
    Gets whether this implementation supports specifying an additional timeout for read operations
    void
    write(List<ByteBuf> buffers)
    Deprecated.
    Write each buffer in the list to the stream in order, blocking until all are completely written.
    void
    Deprecated.
    Write each buffer in the list to the stream in order, asynchronously.

    Methods inherited from interface com.mongodb.connection.BufferProvider

    getBuffer
  • Method Details

    • open

      void open() throws IOException
      Deprecated.
      Open the stream.
      Throws:
      IOException - if an I/O error occurs
    • openAsync

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

      void write(List<ByteBuf> buffers) throws IOException
      Deprecated.
      Write each buffer in the list to the stream in order, blocking until all are completely written.
      Parameters:
      buffers - the buffers to write. The operation must not release any buffer from buffers, unless the operation retains it, and releasing is meant to compensate for that.
      Throws:
      IOException - if there are problems writing to the stream
    • read

      ByteBuf read(int numBytes) throws IOException
      Deprecated.
      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
    • supportsAdditionalTimeout

      default boolean supportsAdditionalTimeout()
      Deprecated.
      Gets whether this implementation supports specifying an additional timeout for read operations

      The default is to not support specifying an additional timeout

      Returns:
      true if this implementation supports specifying an additional timeouts for reads operations
      Since:
      4.1
      See Also:
    • read

      default ByteBuf read(int numBytes, int additionalTimeout) throws IOException
      Deprecated.
      Read from the stream, blocking until the requested number of bytes have been read. If supported by the implementation, adds the given additional timeout to the configured timeout for the stream.

      This method should not be called unless supportsAdditionalTimeout() returns true.

      The default behavior is to throw an UnsupportedOperationException

      Parameters:
      numBytes - The number of bytes to read into the returned byte buffer
      additionalTimeout - additional timeout in milliseconds to add to the configured timeout
      Returns:
      a byte buffer filled with number of bytes requested
      Throws:
      IOException - if there are problems reading from the stream
      UnsupportedOperationException - if this implementation does not support additional timeouts
      Since:
      4.1
      See Also:
    • writeAsync

      void writeAsync(List<ByteBuf> buffers, AsyncCompletionHandler<Void> handler)
      Deprecated.
      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. The operation must not release any buffer from buffers, unless the operation retains it, and releasing is meant to compensate for that.
      handler - invoked when the write operation has completed
    • readAsync

      void readAsync(int numBytes, AsyncCompletionHandler<ByteBuf> handler)
      Deprecated.
      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()
      Deprecated.
      The address that this stream is connected to.
      Returns:
      the address
    • close

      void close()
      Deprecated.
      Closes the connection.
    • isClosed

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