Class UnsynchronizedByteArrayInputStream

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

    public class UnsynchronizedByteArrayInputStream
    extends java.io.InputStream
    This is an alternative to ByteArrayInputStream which removes the synchronization overhead for non-concurrent access; as such this class is not thread-safe.

    To build an instance, see UnsynchronizedByteArrayInputStream.Builder.

    Since:
    2.7
    See Also:
    ByteArrayInputStream
    • Field Detail

      • END_OF_STREAM

        public static final int END_OF_STREAM
        The end of stream marker.
        See Also:
        Constant Field Values
      • data

        private final byte[] data
        The underlying data buffer.
      • eod

        private final int eod
        End Of Data. Similar to data.length, i.e. the last readable offset + 1.
      • offset

        private int offset
        Current offset in the data buffer.
      • markedOffset

        private int markedOffset
        The current mark (if any).
    • Method Detail

      • available

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

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • read

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

        public int read​(byte[] dest)
        Overrides:
        read in class java.io.InputStream
      • read

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

        public void reset()
        Overrides:
        reset in class java.io.InputStream
      • skip

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