de.undercouch.bson4jackson.io
Class StaticBufferedInputStream

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

public class StaticBufferedInputStream
extends java.io.InputStream

Works like BufferedInputStream, but is not thread-safe and also uses a a re-usable static buffer provided by StaticBuffers to achieve better performance


Constructor Summary
StaticBufferedInputStream(java.io.InputStream in)
          Creates a new buffered input stream
StaticBufferedInputStream(java.io.InputStream in, int size)
          Creates a new buffered input stream
 
Method Summary
 void close()
           
 void mark(int marklimit)
           
 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
available, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticBufferedInputStream

public StaticBufferedInputStream(java.io.InputStream in)
Creates a new buffered input stream

Parameters:
in - the original unbuffered input stream

StaticBufferedInputStream

public StaticBufferedInputStream(java.io.InputStream in,
                                 int size)
Creates a new buffered input stream

Parameters:
in - the original unbuffered input stream
size - the minimum buffer size
Method Detail

close

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

read

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

read

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

skip

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

markSupported

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

mark

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

reset

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