org.norther.tammi.spray.filter.chain
Class ServletInputStreamWrapper

java.lang.Object
  extended by java.io.InputStream
      extended by javax.servlet.ServletInputStream
          extended by org.norther.tammi.spray.filter.chain.ServletInputStreamWrapper
All Implemented Interfaces:
Closeable

public class ServletInputStreamWrapper
extends ServletInputStream

A servlet input stream wrapper supporting a length limit.

Note that the wrapped stream is not closed by the close method of this stream.

Version:
$Id: ServletInputStreamWrapper.java,v 1.8 2009/09/28 15:08:28 cvsimp Exp $
Author:
Ilkka Priha

Constructor Summary
ServletInputStreamWrapper()
          Constructs a new input stream.
ServletInputStreamWrapper(InputStream in)
          Constructs a new input stream with an adapter.
ServletInputStreamWrapper(InputStream in, int len)
          Constructs a new input stream with an adapter and length.
 
Method Summary
 int available()
           
 void close()
          Marks the stream as closed, but doesn't close the wrapped one.
 boolean isClosed()
          Check whether the stream is closed.
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class javax.servlet.ServletInputStream
readLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletInputStreamWrapper

public ServletInputStreamWrapper()
Constructs a new input stream.


ServletInputStreamWrapper

public ServletInputStreamWrapper(InputStream in)
Constructs a new input stream with an adapter.

Parameters:
in - the wrapped input stream.

ServletInputStreamWrapper

public ServletInputStreamWrapper(InputStream in,
                                 int len)
Constructs a new input stream with an adapter and length.

Parameters:
in - the wrapped input stream.
len - the length of the stream.
Method Detail

available

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

read

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

read

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

read

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

mark

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

reset

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

skip

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

close

public void close()
           throws IOException
Marks the stream as closed, but doesn't close the wrapped one.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException - on errors.

isClosed

public boolean isClosed()
Check whether the stream is closed.

Returns:
true if closed, otherwise false.


Copyright © 2004 The Norther Organization. All rights reserved.