Class InputByteStreamImpl

java.lang.Object
com.adobe.internal.io.stream.InputByteStreamImpl
All Implemented Interfaces:
InputByteStream
Direct Known Subclasses:
PaddedInputByteStream, RangeInputByteStream

public abstract class InputByteStreamImpl extends Object implements InputByteStream
Only for internal engineering use. This api can change without notice.
  • Field Summary

    Fields inherited from interface com.adobe.internal.io.stream.InputByteStream

    EOF
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Only for internal engineering use.
    abstract void
    Closes this InputByteStream and releases any system resources associated with the stream.
    boolean
    eof()
    Only for internal engineering use.
    abstract long
    Only for internal engineering use.
    abstract long
    Only for internal engineering use.
    abstract int
    Only for internal engineering use.
    int
    read(byte[] bytes)
    Only for internal engineering use.
    abstract int
    read(byte[] bytes, int position, int length)
    Only for internal engineering use.
    seek(long position)
    Only for internal engineering use.
    Only for internal engineering use.
    slice(long begin, long length)
    Only for internal engineering use.
    Create an InputStream that represents the same data as this InputByteStream.
    Only for internal engineering use.
    int
    Only for internal engineering use.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • slice

      public abstract InputByteStream slice(long begin, long length) throws IOException
      Only for internal engineering use. This api can change without notice. Create a new InputByteStream that that provides another view on the underlying data. This new InputByteStream is completely independent and can be read from and positioned without affecting the original or any other slice InputByteStream objects. The initial position of the slice is at zero - the beginning of the slice.
      Specified by:
      slice in interface InputByteStream
      Parameters:
      begin - Offset within the current InputByteStream to start the slice.
      length - The length of the slice.
      Returns:
      A slice of the original InputByteStream.
      Throws:
      IOException
    • slice

      public InputByteStream slice() throws IOException
      Only for internal engineering use. This api can change without notice. Create a new InputByteStream that that provides another view on the underlying data. This new InputByteStream is completely independent and can be read from and positioned without affecting the original or any other slice InputByteStream objects. The initial position of the slice is at zero - the beginning of the slice. The slice has the same bounds as the original InputByteStream. One common but probably incorrect usage of this method is to create a temporary "view" on the data that is used briefly within a method and then discarded. This is pretty wasteful and creates a number of small objects. In that case it would be better to find the current position using getPosition() and store it locally in the method and then restore the position with setPosition() before returning from the method.
      Specified by:
      slice in interface InputByteStream
      Returns:
      A slice of the original InputByteStream.
      Throws:
      IOException
    • read

      public abstract int read() throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. Read the byte at the current position. If the current position is at or beyond the end of the underlying data return a -1. If not beyond the end of the underlying data the current position is incremented by 1.
      Specified by:
      read in interface InputByteStream
      Returns:
      The byte at the current position or -1 if at or beyond EOF.
      Throws:
      IOException
    • read

      public abstract int read(byte[] bytes, int position, int length) throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.
      Specified by:
      read in interface InputByteStream
      Parameters:
      bytes - The destination array.
      position - The offset in the byte array to put the first byte read.
      length - The number of bytes to read.
      Throws:
      IOException
    • read

      public int read(byte[] bytes) throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.
      Specified by:
      read in interface InputByteStream
      Parameters:
      bytes - The destination array.
      Throws:
      IOException
    • unget

      public int unget() throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. "Unget" the byte from underlying data. This essentially returns the byte just before the current position and sets the current position to point at that byte (one before the current position).
      Specified by:
      unget in interface InputByteStream
      Throws:
      IOException
    • seek

      public abstract InputByteStream seek(long position) throws IOException
      Only for internal engineering use. This api can change without notice. Set the current position in the underlying data. This position is pegged to be no less than zero and no greater than the length of the InputByteStream.
      Specified by:
      seek in interface InputByteStream
      Parameters:
      position - Where to set the current position.
      Returns:
      This object.
      Throws:
      IOException
    • getPosition

      public abstract long getPosition() throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. Get the current position.
      Specified by:
      getPosition in interface InputByteStream
      Returns:
      The current position.
      Throws:
      IOException
    • length

      public abstract long length() throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. The maximum number of bytes that can be read from this InputByteStream.
      Specified by:
      length in interface InputByteStream
      Returns:
      Total number of bytes available in this InputByteStream.
      Throws:
      IOException
    • bytesAvailable

      public long bytesAvailable() throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. The number of bytes available to be read from the current position.
      Specified by:
      bytesAvailable in interface InputByteStream
      Returns:
      Number of bytes available from the current position in this InputByteStream.
      Throws:
      IOException
    • eof

      public boolean eof() throws IOException
      Description copied from interface: InputByteStream
      Only for internal engineering use. This api can change without notice. Is the current position of this InputByteStream at or beyond the end of the underlying data.
      Specified by:
      eof in interface InputByteStream
      Returns:
      True if the current position is beyond the end of the underlying data, false otherwise.
      Throws:
      IOException
    • close

      public abstract void close() throws IOException
      Description copied from interface: InputByteStream
      Closes this InputByteStream and releases any system resources associated with the stream. After this method is called then any further calls to this instance are errors.
      Specified by:
      close in interface InputByteStream
      Throws:
      IOException
    • toString

      public String toString()
      Only for internal engineering use. This api can change without notice.
      Overrides:
      toString in class Object
    • toInputStream

      public InputStream toInputStream() throws IOException
      Description copied from interface: InputByteStream
      Create an InputStream that represents the same data as this InputByteStream. The new InputStream is independent of the InputByteStream and operations on one will not affect the other including closing of either stream.
      Specified by:
      toInputStream in interface InputByteStream
      Returns:
      an InputStream that refers to the same underlying data
      Throws:
      IOException