java.lang.Object
com.independentsoft.io.structuredstorage.DirectoryEntry
com.independentsoft.io.structuredstorage.Stream
All Implemented Interfaces:
Comparable<DirectoryEntry>

public class Stream extends DirectoryEntry
Represents a virtual stream to store data. Stream is analogous to a file system file. The parent object of a stream object must be a Storage object or the RootDirectoryEntry.
  • Constructor Details

    • Stream

      public Stream()
      Initializes a new instance of the Stream class.
    • Stream

      public Stream(String filePath) throws IOException
      Initializes a new instance of the Stream class and load data from the specified file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • Stream

      public Stream(String name, InputStream stream) throws IOException
      Initializes a new instance of the Stream class and load data from the specified System.IO.Stream.
      Parameters:
      name - the name
      stream - the stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • Stream

      public Stream(String name, byte[] buffer)
      Initializes a new instance of the Stream class and load data from the specified buffer.
      Parameters:
      name - the name
      buffer - the buffer
  • Method Details

    • load

      public void load(String filePath) throws IOException
      Loads data to this stream from the specified file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • load

      public void load(String name, InputStream inputStream) throws IOException
      Loads data to this stream from the specified InputStream.
      Parameters:
      name - the name
      inputStream - the input stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • load

      public void load(String name, byte[] buffer)
      Loads data to this stream from the specified buffer.
      Parameters:
      name - the name
      buffer - the buffer
    • save

      public void save(String filePath) throws IOException
      Saves data from this stream to to the specified file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • save

      public void save(OutputStream stream) throws IOException
      Saves data from this stream to the specified stream.
      Parameters:
      stream - the stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getInputStream

      public InputStream getInputStream()
      Gets InputStream to read data from this stream.
      Returns:
      the input stream
    • getBuffer

      public byte[] getBuffer()
      Gets streams data.
      Returns:
      the buffer
    • setBuffer

      public void setBuffer(byte[] buffer)
      Sets streams data.
      Parameters:
      buffer - the new buffer