Class UnsynchronizedByteArrayInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class UnsynchronizedByteArrayInputStream
    extends InputStream
    This is an alternative to ByteArrayInputStream which removes the synchronization overhead for non-concurrent access; as such this class is not thread-safe.
    Since:
    2.7
    • Field Detail

      • END_OF_STREAM

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

      • UnsynchronizedByteArrayInputStream

        public UnsynchronizedByteArrayInputStream​(byte[] data)
        Creates a new byte array input stream.
        Parameters:
        data - the buffer
      • UnsynchronizedByteArrayInputStream

        public UnsynchronizedByteArrayInputStream​(byte[] data,
                                                  int offset)
        Creates a new byte array input stream.
        Parameters:
        data - the buffer
        offset - the offset into the buffer
        Throws:
        IllegalArgumentException - if the offset is less than zero
      • UnsynchronizedByteArrayInputStream

        public UnsynchronizedByteArrayInputStream​(byte[] data,
                                                  int offset,
                                                  int length)
        Creates a new byte array input stream.
        Parameters:
        data - the buffer
        offset - the offset into the buffer
        length - the length of the buffer
        Throws:
        IllegalArgumentException - if the offset or length less than zero