Package org.jppf.io

Interface InputSource

All Superinterfaces:
AutoCloseable, Closeable, IO
All Known Implementing Classes:
ChannelInputSource, FileInputSource, SocketWrapperInputSource, StreamInputSource

public interface InputSource extends IO
This interface represents an abstraction of any source of incoming data.
Author:
Laurent Cohen
  • Method Details

    • read

      int read(byte[] data, int offset, int len) throws Exception
      Read data from this input source into an array of bytes.
      Parameters:
      data - the buffer into which to write.
      offset - the position in the buffer where to start storing the data.
      len - the size in bytes of the data to read.
      Returns:
      the number of bytes actually read, or -1 if end of stream was reached.
      Throws:
      Exception - if an IO error occurs.
    • read

      int read(ByteBuffer data) throws Exception
      Read data from this input source into a byte buffer.
      Parameters:
      data - the buffer into which to write.
      Returns:
      the number of bytes actually read, or -1 if end of stream was reached.
      Throws:
      Exception - if an IO error occurs.
    • readInt

      int readInt() throws Exception
      Read an int value from this input source.
      Returns:
      the value read, or -1 if an end of file condition was reached.
      Throws:
      Exception - if an IO error occurs.
    • skip

      int skip(int n) throws Exception
      Skip n bytes of data form this input source.
      Parameters:
      n - the number of bytes to skip.
      Returns:
      the number of bytes actually skipped.
      Throws:
      Exception - if an IO error occurs.