Package org.jppf.nio

Interface NioObject

All Known Implementing Classes:
AbstractNioObject, PlainNioObject, SSLNioObject

public interface NioObject
Abstraction of a sequence of data read from, or written to a data channel. The size of the data is known before the read or write operation.

Furthermore, multiple calls to the read() or write() method may be required for the read or write operation to complete. This implies that an implementation of this interface should keep state information between calls.

Author:
Laurent Cohen
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Get the actual bytes sent to or received from the underlying channel.
    Location of the data to read or write.
    int
    Get the size of the data ot send or receive.
    boolean
    Attempt to read an object from an inbound channel.
    Reset this object.
    boolean
    Attempt to write an object to an outbound channel.
  • Method Details

    • read

      boolean read() throws Exception
      Attempt to read an object from an inbound channel.
      Returns:
      true if an object was fully read, false otherwise.
      Throws:
      Exception - if any error occurs.
    • write

      boolean write() throws Exception
      Attempt to write an object to an outbound channel.
      Returns:
      true if an object was fully written, false otherwise.
      Throws:
      Exception - if any error occurs.
    • getData

      DataLocation getData()
      Location of the data to read or write.
      Returns:
      a DataLocation instance.
    • getSize

      int getSize()
      Get the size of the data ot send or receive.
      Returns:
      the size as an int.
    • getChannelCount

      long getChannelCount()
      Get the actual bytes sent to or received from the underlying channel.
      Returns:
      the number of bytes as a long value.
    • reset

      NioObject reset()
      Reset this object.
      Returns:
      an Object of the same class.