org.sakaiproject.entitybroker.util.http
Class LazyRequestInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by javax.servlet.ServletInputStream
          extended by org.sakaiproject.entitybroker.util.http.LazyRequestInputStream
All Implemented Interfaces:
Closeable

public class LazyRequestInputStream
extends javax.servlet.ServletInputStream

This provides lazy access to the ServletInputStream data in a request, this avoids issues with attempting to read data which was is later requested from the reader since it will not actually do any reads using the ServletInputStream but still can pretend to

Author:
Aaron Zeckoski (azeckoski @ gmail.com)

Field Summary
 javax.servlet.http.HttpServletRequest request
           
 javax.servlet.ServletInputStream stream
           
 
Constructor Summary
LazyRequestInputStream(javax.servlet.http.HttpServletRequest request)
          Construct a new lazy inputstream from the given request
 
Method Summary
 int available()
           
 void close()
           
 boolean equals(Object obj)
           
 int hashCode()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 int readLine(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

stream

public javax.servlet.ServletInputStream stream

request

public javax.servlet.http.HttpServletRequest request
Constructor Detail

LazyRequestInputStream

public LazyRequestInputStream(javax.servlet.http.HttpServletRequest request)
Construct a new lazy inputstream from the given request

Parameters:
request - any http request, cannot be null
Method Detail

readLine

public int readLine(byte[] b,
                    int off,
                    int len)
             throws IOException
Overrides:
readLine in class javax.servlet.ServletInputStream
Throws:
IOException

available

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

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close 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

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

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2012 CARET, University of Cambridge. All Rights Reserved.