Class SOInputStream

java.lang.Object
java.io.InputStream
com.artifex.solib.SOInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class SOInputStream extends InputStream
This class implements an InputStream that can be used to read from both regular and secure files.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
    void
    Closes this input stream and releases any system resources associated with the stream.
    void
    mark(int readLimit)
    Marks the current position in this input stream.
    boolean
    Tests if this input stream supports the mark and reset methods
    int
    Reads the next byte of data from the input stream.
    int
    read(byte[] b)
    Reads some number of bytes from the input stream and stores them into the buffer array b
    int
    read(byte[] b, int off, int len)
    Reads up to len bytes of data from the input stream into an array of bytes.
    void
    Repositions this stream to the position at the time the mark method was last called on this input stream.
    long
    skip(long n)
    Skips over and discards n bytes of data from this input stream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SOInputStream

      public SOInputStream(String path)
      Constructor
      Parameters:
      path - Full path to the 'input' file.
  • Method Details

    • available

      public int available()
      Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
      Overrides:
      available in class InputStream
      Returns:
      The estimate. 0 on EOF.
    • close

      public void close()
      Closes this input stream and releases any system resources associated with the stream.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
    • mark

      public void mark(int readLimit)
      Marks the current position in this input stream. This is not implemented for the SecureFS case. The feature is disabled in markSupported().
      Overrides:
      mark in class InputStream
      Parameters:
      readLimit - The maximum limit of bytes that can be read before the mark position becomes invalid.
    • markSupported

      public boolean markSupported()
      Tests if this input stream supports the mark and reset methods
      Overrides:
      markSupported in class InputStream
      Returns:
      True if it is, False if not.
    • read

      public int read()
      Reads the next byte of data from the input stream.
      Specified by:
      read in class InputStream
      Returns:
      The byte. -1 on EOF
    • read

      public int read(byte[] b, int off, int len)
      Reads up to len bytes of data from the input stream into an array of bytes.
      Overrides:
      read in class InputStream
      Parameters:
      b - The buffer into which the data is read.
      off - The start offset in array b at which the data is written.
      len - The maximum number of bytes to read.
      Returns:
      The total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
    • read

      public int read(byte[] b)
      Reads some number of bytes from the input stream and stores them into the buffer array b
      Overrides:
      read in class InputStream
      Parameters:
      b - The buffer into which the data is read.
      Returns:
      The total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
    • reset

      public void reset()
      Repositions this stream to the position at the time the mark method was last called on this input stream. This is not implemented for the SecureFS case. The feature is disabled in markSupported().
      Overrides:
      reset in class InputStream
    • skip

      public long skip(long n)
      Skips over and discards n bytes of data from this input stream
      Overrides:
      skip in class InputStream