org.ws4d.java.io.buffered
Class BufferedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.ws4d.java.io.buffered.BufferedInputStream
All Implemented Interfaces:
java.io.Closeable

public class BufferedInputStream
extends java.io.InputStream

This class allows the enabling of mark support on an input stream. It is possible to read some bytes from the stream without exhausting it.


Constructor Summary
BufferedInputStream(java.io.InputStream in)
          This class allows the enabling of mark support on an input stream.
BufferedInputStream(java.io.InputStream in, int maxsize)
          This class allows the enabling of mark support on an input stream.
BufferedInputStream(java.io.InputStream in, int size, int maxsize)
          This class allows the enabling of mark support on an input stream.
 
Method Summary
 int available()
           
 void close()
           
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isMarked()
          Returns true if the stream has a mark set, false otherwise.
 boolean isMarkWatched()
          Is mark watched?
 boolean isTimeoutMode()
          Is timeout mode enabled?
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int length)
           
 void reset()
           
 void setMarkWatchMode(boolean mode)
          Allows the stream to throw a MarkReachedException.
 void setTimeoutMode(boolean mode)
          Set the timeout mode.
 java.lang.String toString()
           
 
Methods inherited from class java.io.InputStream
skip
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BufferedInputStream

public BufferedInputStream(java.io.InputStream in)
This class allows the enabling of mark support on an input stream. It is possible to read some bytes from the stream without exhausting it.

Parameters:
in - input stream without mark support.

BufferedInputStream

public BufferedInputStream(java.io.InputStream in,
                           int maxsize)
This class allows the enabling of mark support on an input stream. It is possible to read some bytes from the stream without exhausting it.

Parameters:
in - input stream without mark support.
maxsize - do not read more bytes.

BufferedInputStream

public BufferedInputStream(java.io.InputStream in,
                           int size,
                           int maxsize)
This class allows the enabling of mark support on an input stream. It is possible to read some bytes from the stream without exhausting it.

Parameters:
in - input stream without mark support.
size - buffer size.
maxsize - do not read more bytes.
Method Detail

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 length)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

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

reset

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

markSupported

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

available

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

mark

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

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

isMarked

public boolean isMarked()
Returns true if the stream has a mark set, false otherwise.

Returns:
true if the stream has a mark set, false otherwise.

setMarkWatchMode

public void setMarkWatchMode(boolean mode)
Allows the stream to throw a MarkReachedException. This Exception will be thrown if someone reads until the set mark.

Parameters:
mode - true to allow exception.

isMarkWatched

public boolean isMarkWatched()
Is mark watched?

Returns:
true if mark is watched, false otherwise.

isTimeoutMode

public boolean isTimeoutMode()
Is timeout mode enabled?

Returns:
true if this stream is in timeout mode, false otherwise.

setTimeoutMode

public void setTimeoutMode(boolean mode)
Set the timeout mode.

Parameters:
mode - true enables timeout mode, false disables it.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object