Class BufferedMagicNumberStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    final class BufferedMagicNumberStream
    extends FilterInputStream
    This class defines is a buffered input stream which provides additional reading functions which hare very useful for a MagicNumberStream.
    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:40
    Author:
    Stéphane GALLAND
    See Also:
    MagicNumberStream
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    inputoutput
    • Constructor Detail

      • BufferedMagicNumberStream

        BufferedMagicNumberStream​(InputStream is)
        Constructor.
        Parameters:
        is - is the input stream.
    • Method Detail

      • getStream

        public InputStream getStream()
        Replies the stream buffered by this object. This buffered stream is the stream pass as parameter of the constructor.
        Returns:
        the buffered stream.
      • read

        public byte[] read​(int offset,
                           int length)
                    throws IOException
        Replies the bytes at the specified offset.
        Parameters:
        offset - is the position of the first byte to read.
        length - is the count of bytes to read.
        Returns:
        the array of red bytes.
        Throws:
        IOException - in case of problems
      • read

        public byte read​(int offset)
                  throws IOException
        Replies a byte at the specified offset.
        Parameters:
        offset - is the position of the byte to read.
        Returns:
        the byte.
        Throws:
        IOException - in case of problems
      • readLine

        public byte[] readLine​(int offset)
                        throws IOException
        Replies the bytes until the next end of the first line (inclusive).
        Parameters:
        offset - is the position of the byte to read.
        Returns:
        the bytes; or null if EOF
        Throws:
        IOException - in case of problems