Class FastByteArrayInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class FastByteArrayInputStream
    extends java.io.InputStream
    ByteArrayInputStream implementation that does not synchronize methods, nor does it check for the end of stream. If the end of stream is read, exceptions may be thrown.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected byte[] buf
      Our byte buffer
      protected int count
      Number of bytes that we can read from the buffer
      protected int pos
      Number of bytes that have been read from the buffer
    • Constructor Summary

      Constructors 
      Constructor Description
      FastByteArrayInputStream​(byte[] buf, int pos, int count)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      java.lang.Object getLock()
      when reading from this stream, you need a lock on this object.
      int read()  
      int read​(byte[] b, int off, int len)  
      long skip​(long n)  
      • Methods inherited from class java.io.InputStream

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

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

      • buf

        protected final byte[] buf
        Our byte buffer
      • count

        protected int count
        Number of bytes that we can read from the buffer
      • pos

        protected int pos
        Number of bytes that have been read from the buffer
    • Constructor Detail

      • FastByteArrayInputStream

        public FastByteArrayInputStream​(byte[] buf,
                                        int pos,
                                        int count)
    • Method Detail

      • available

        public final int available()
        Overrides:
        available in class java.io.InputStream
      • read

        public final int read()
        Specified by:
        read in class java.io.InputStream
      • read

        public final int read​(byte[] b,
                              int off,
                              int len)
        Overrides:
        read in class java.io.InputStream
      • skip

        public final long skip​(long n)
        Overrides:
        skip in class java.io.InputStream
      • getLock

        public java.lang.Object getLock()
        when reading from this stream, you need a lock on this object.
        Returns: