Class MultipleBuffersOutputStream

java.lang.Object
java.io.OutputStream
org.jppf.utils.streams.MultipleBuffersOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

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

    • MultipleBuffersOutputStream

      public MultipleBuffersOutputStream()
      Initialize this output stream with a default buffer length of 32768.
    • MultipleBuffersOutputStream

      public MultipleBuffersOutputStream(List<JPPFBuffer> initialList)
      Initialize this output stream with a default buffer length of 32768.
      Parameters:
      initialList - contains the data that is written to this output stream.
  • Method Details

    • write

      public void write(int b) throws IOException
      Write a single byte into this output stream.
      Specified by:
      write in class OutputStream
      Parameters:
      b - the data to write.
      Throws:
      IOException - if any error occurs.
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Writes len bytes from the specified byte array starting at offset off to this output stream.
      Overrides:
      write in class OutputStream
      Parameters:
      b - the data.
      off - the start offset in the data.
      len - the number of bytes to write.
      Throws:
      IOException - if any error occurs.
    • write

      public void write(byte[] b) throws IOException
      Writes the specified byte array to this output stream.
      Overrides:
      write in class OutputStream
      Parameters:
      b - the data to write.
      Throws:
      IOException - if any error occurs.
    • size

      public int size()
      Get the size of the content of this output stream.
      Returns:
      the size as an int value.
    • toBufferList

      public List<JPPFBuffer> toBufferList()
      Get the content of the output stream as a list of JPPFBuffer instances.
      Returns:
      a list of JPPFBuffer instances.
    • toString

      public String toString()
      Overrides:
      toString in class Object