Package org.jppf.nio

Class PlainNioObject

All Implemented Interfaces:
NioObject

public class PlainNioObject extends AbstractNioObject
Instances of this class represent a data frame read asynchronously from an input source.
Author:
Laurent Cohen
  • Constructor Details

    • PlainNioObject

      public PlainNioObject(SocketChannel channel, int size)
      Initialize this NioObject with the specified channel and size.
      Parameters:
      channel - where to read or write the data.
      size - the size of the internal buffer.
    • PlainNioObject

      public PlainNioObject(SocketChannel channel, JPPFBuffer buf)
      Initialize this NioObject with the specified channel and size.
      Parameters:
      channel - where to read or write the data.
      buf - the internal buffer.
    • PlainNioObject

      public PlainNioObject(SocketChannel channel, DataLocation location)
      Initialize this NioObject with the specified size.
      Parameters:
      channel - where to read or write the data.
      location - the location of the data to read from or write to.
  • Method Details

    • read

      public boolean read() throws Exception
      Read the current block of data.
      Returns:
      true if the data has been read fully, false otherwise.
      Throws:
      Exception - if any error occurs.
    • write

      public boolean write() throws Exception
      Write the current data object.
      Returns:
      true if the data has been written fully, false otherwise.
      Throws:
      Exception - if any error occurs.
    • toString

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

      public NioObject reset()
      Description copied from interface: NioObject
      Reset this object.
      Specified by:
      reset in interface NioObject
      Overrides:
      reset in class AbstractNioObject
      Returns:
      an Object of the same class.