Class MultipleBuffersInputStream

java.lang.Object
java.io.InputStream
org.jppf.utils.streams.MultipleBuffersInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class MultipleBuffersInputStream extends InputStream
An output stream implementation that minimizes memory usage.
Author:
Laurent Cohen
  • Constructor Details

    • MultipleBuffersInputStream

      public MultipleBuffersInputStream(JPPFBuffer[] buffers)
      Initialize this input stream with the specified buffers.
      Parameters:
      buffers - an array of JPPFBuffer instances.
  • Method Details

    • read

      public int read() throws IOException
      Read a single byte from this input stream.
      Specified by:
      read in class InputStream
      Returns:
      the data read.
      Throws:
      IOException - if any error occurs.
    • read

      public int read(byte[] b, int off, int len) throws IOException
      Read from this input stream into the specified byte array.
      Overrides:
      read in class InputStream
      Parameters:
      b - buffer that receives the data read form this stream.
      off - the start offset in the buffer.
      len - the number of bytes to read.
      Returns:
      the number of bytes read from the stream, or -1 if end of file was reached.
      Throws:
      IOException - if any error occurs.
    • read

      public int read(byte[] b) throws IOException
      Read from this input stream into the specified byte array.
      Overrides:
      read in class InputStream
      Parameters:
      b - buffer that receives the data read form this stream.
      Returns:
      the number of bytes read from the stream, or -1 if end of file was reached.
      Throws:
      IOException - if any error occurs.
    • toString

      public String toString()
      Overrides:
      toString in class Object