Class UnsafeByteArrayInputStream

java.lang.Object
java.io.InputStream
de.undercouch.bson4jackson.io.UnsafeByteArrayInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class UnsafeByteArrayInputStream extends InputStream
An input stream that serves the content of an array. Compared to ByteArrayInputStream this class is not thread-safe.
  • Field Details

    • _buf

      protected final byte[] _buf
      The buffer to serve
    • _pos

      protected int _pos
      The current position in the buffer
    • _count

      protected int _count
      The index one greater than the last byte to serve
    • _mark

      protected int _mark
      The current marked position
  • Constructor Details

    • UnsafeByteArrayInputStream

      public UnsafeByteArrayInputStream(byte[] buf)
      Creates a new stream that serves the whole given array
      Parameters:
      buf - the array to serve
    • UnsafeByteArrayInputStream

      public UnsafeByteArrayInputStream(byte[] buf, int off, int len)
      Creates a new stream that serves part of the given array
      Parameters:
      buf - the array to serve
      off - the index of the first byte to serve
      len - the number of bytes to serve
  • Method Details