Package org.apache.commons.io.input

# Class UnsynchronizedByteArrayInputStream

java.lang.Object
java.io.InputStream
org.apache.commons.io.input.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.

To build an instance, use `UnsynchronizedByteArrayInputStream.Builder`.

Since:
  2.7
See Also:
  - `UnsynchronizedByteArrayInputStream.Builder`
  - `ByteArrayInputStream`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `UnsynchronizedByteArrayInputStream.Builder`
  Builds a new `UnsynchronizedByteArrayInputStream`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `END_OF_STREAM`
  The end of stream marker.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnsynchronizedByteArrayInputStream(byte[] data)`
  Deprecated.
  Use `builder()`, `UnsynchronizedByteArrayInputStream.Builder`, and `UnsynchronizedByteArrayInputStream.Builder.get()`.
  `UnsynchronizedByteArrayInputStream(byte[] data, int offset)`
  Deprecated.
  Use `builder()`, `UnsynchronizedByteArrayInputStream.Builder`, and `UnsynchronizedByteArrayInputStream.Builder.get()`.
  `UnsynchronizedByteArrayInputStream(byte[] data, int offset, int length)`
  Deprecated.
  Use `builder()`, `UnsynchronizedByteArrayInputStream.Builder`, and `UnsynchronizedByteArrayInputStream.Builder.get()`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `available()`
  `static UnsynchronizedByteArrayInputStream.Builder`
  `builder()`
  Constructs a new `UnsynchronizedByteArrayInputStream.Builder`.
  `void`
  `mark(int readLimit)`
  `boolean`
  `markSupported()`
  `int`
  `read()`
  `int`
  `read(byte[] dest)`
  `int`
  `read(byte[] dest, int off, int len)`
  `void`
  `reset()`
  `long`
  `skip(long n)`

  ### Methods inherited from class java.io.InputStream

  `close`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### END_OF_STREAM

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

- ## Constructor Details

  - ### UnsynchronizedByteArrayInputStream

    @Deprecated public UnsynchronizedByteArrayInputStream(byte[] data)
    Deprecated.
    Use `builder()`, `UnsynchronizedByteArrayInputStream.Builder`, and `UnsynchronizedByteArrayInputStream.Builder.get()`.
    Constructs a new byte array input stream.
    Parameters:
      `data` - the buffer.

  - ### UnsynchronizedByteArrayInputStream

    @Deprecated public UnsynchronizedByteArrayInputStream(byte[] data, int offset)
    Deprecated.
    Use `builder()`, `UnsynchronizedByteArrayInputStream.Builder`, and `UnsynchronizedByteArrayInputStream.Builder.get()`.
    Constructs 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

    @Deprecated public UnsynchronizedByteArrayInputStream(byte[] data, int offset, int length)
    Deprecated.
    Use `builder()`, `UnsynchronizedByteArrayInputStream.Builder`, and `UnsynchronizedByteArrayInputStream.Builder.get()`.
    Constructs 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.

- ## Method Details

  - ### builder

    public static UnsynchronizedByteArrayInputStream.Builder builder()
    Constructs a new `UnsynchronizedByteArrayInputStream.Builder`.
    Returns:
      a new `UnsynchronizedByteArrayInputStream.Builder`.

  - ### available

    public int available()
    Overrides:
      `available` in class `InputStream`

  - ### mark

    public void mark(int readLimit)
    Overrides:
      `mark` in class `InputStream`

  - ### markSupported

    public boolean markSupported()
    Overrides:
      `markSupported` in class `InputStream`

  - ### read

    public int read()
    Specified by:
      `read` in class `InputStream`

  - ### read

    public int read(byte[] dest)
    Overrides:
      `read` in class `InputStream`

  - ### read

    public int read(byte[] dest, int off, int len)
    Overrides:
      `read` in class `InputStream`

  - ### reset

    public void reset()
    Overrides:
      `reset` in class `InputStream`

  - ### skip

    public long skip(long n)
    Overrides:
      `skip` in class `InputStream`