de.undercouch.bson4jackson.io
Class UnsafeByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by de.undercouch.bson4jackson.io.UnsafeByteArrayInputStream
All Implemented Interfaces:
java.io.Closeable

public class UnsafeByteArrayInputStream
extends java.io.InputStream

An input stream that serves the content of an array. Compared to ByteArrayInputStream this class is not thread-safe.


Constructor Summary
UnsafeByteArrayInputStream(byte[] buf)
          Creates a new stream that serves the whole given array
UnsafeByteArrayInputStream(byte[] buf, int off, int len)
          Creates a new stream that serves part of the given array
 
Method Summary
 int available()
           
 void close()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

read

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

read

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

skip

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

available

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

markSupported

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

mark

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

reset

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

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream