Class ByteProviderPaddedInputStream

  • All Implemented Interfaces:, java.lang.AutoCloseable

    public class ByteProviderPaddedInputStream
    Wraps a ByteProvider and presents it as an InputStream.

    This InputStream will be limited to a region of the underlying ByteProvider, and has an optional amount of padding at the end of the stream where the stream will appear to have bytes with a value of zero.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      int read()  
      • Methods inherited from class

        mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • ByteProviderPaddedInputStream

        public ByteProviderPaddedInputStream​(ByteProvider provider,
                                             long startOffset,
                                             long length,
                                             long padCount)
        Create a new ByteProviderInputStream instance, using the specified ByteProvider as the source of the bytes returned from this stream.

        The source ByteProvider is not closed when this stream is closed.

        The total number of bytes that can be read from this instance will be length + padCount.

        provider - the ByteProvider to wrap.
        startOffset - the starting offset in the ByteProvider.
        length - the number of bytes from the ByteProvider to allow to be read by this InputStream.
        padCount - the number of fake zero bytes to add after the real length bytes.
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface
        close in class
      • read

        public int read()
        Specified by:
        read in class
      • available

        public int available()
        available in class