Class SocketStream

java.lang.Object
com.mongodb.internal.connection.SocketStream
All Implemented Interfaces:
BufferProvider, Stream
Direct Known Subclasses:
UnixSocketChannelStream

@Deprecated(since="2021-05-27") public class SocketStream extends Object implements Stream
Deprecated.
  • Constructor Details

  • Method Details

    • open

      public void open()
      Deprecated.
      Description copied from interface: Stream
      Open the stream.
      Specified by:
      open in interface Stream
    • getBuffer

      public ByteBuf getBuffer(int size)
      Deprecated.
      Description copied from interface: BufferProvider
      Gets a buffer with the givens capacity.
      Specified by:
      getBuffer in interface BufferProvider
      Parameters:
      size - the size required for the buffer
      Returns:
      a ByteBuf with the given size, which is now owned by the caller and must be released.
    • write

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

      public ByteBuf read(int numBytes) throws IOException
      Deprecated.
      Description copied from interface: Stream
      Read from the stream, blocking until the requested number of bytes have been read.
      Specified by:
      read in interface Stream
      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
    • openAsync

      public void openAsync(AsyncCompletionHandler<Void> handler)
      Deprecated.
      Description copied from interface: Stream
      Open the stream asynchronously.
      Specified by:
      openAsync in interface Stream
      Parameters:
      handler - the completion handler for opening the stream
    • writeAsync

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

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

      public ServerAddress getAddress()
      Deprecated.
      Description copied from interface: Stream
      The address that this stream is connected to.
      Specified by:
      getAddress in interface Stream
      Returns:
      the address
    • close

      public void close()
      Deprecated.
      Description copied from interface: Stream
      Closes the connection.
      Specified by:
      close in interface Stream
    • isClosed

      public boolean isClosed()
      Deprecated.
      Description copied from interface: Stream
      Returns the closed state of the connection
      Specified by:
      isClosed in interface Stream
      Returns:
      true if connection is closed