org.jsmpp.util
Class StrictBufferedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by org.jsmpp.util.StrictBufferedInputStream
All Implemented Interfaces:
java.io.Closeable

public class StrictBufferedInputStream
extends java.io.BufferedInputStream

There were some ongoing bugs related to use of DataInputStream in conjunction with BufferedInputStream. Listed below: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4112757 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4030995 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4401235 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4100022 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4479751 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6192696 This class can be used a drop-in replacement for BufferedInputStream and provides a workaround to the faulty behavior in BufferedInputStream. Adapted from the comment by steffen.hauptmann@epost.de at the URL below: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4030995

Author:
Shantanu Kumar (kumar.shantanu@gmail.com)

Field Summary
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
StrictBufferedInputStream(java.io.InputStream in)
           
StrictBufferedInputStream(java.io.InputStream in, int size)
           
 
Method Summary
 int read(byte[] buffer, int bufPos, int length)
          Workaround for an unexpected behavior of 'BufferedInputStream'!
 
Methods inherited from class java.io.BufferedInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrictBufferedInputStream

public StrictBufferedInputStream(java.io.InputStream in)

StrictBufferedInputStream

public StrictBufferedInputStream(java.io.InputStream in,
                                 int size)
Method Detail

read

public int read(byte[] buffer,
                int bufPos,
                int length)
         throws java.io.IOException
Workaround for an unexpected behavior of 'BufferedInputStream'!

Overrides:
read in class java.io.BufferedInputStream
Throws:
java.io.IOException