Class LazyRequestInputStream
- java.lang.Object
-
- java.io.InputStream
-
- javax.servlet.ServletInputStream
-
- org.sakaiproject.entitybroker.util.http.LazyRequestInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class LazyRequestInputStream extends ServletInputStream
This provides lazy access to theServletInputStreamdata 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 theServletInputStreambut still can pretend to- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description HttpServletRequestrequestServletInputStreamstream
-
Constructor Summary
Constructors Constructor Description LazyRequestInputStream(HttpServletRequest request)Construct a new lazy inputstream from the given request
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()booleanequals(Object obj)inthashCode()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)intreadLine(byte[] b, int off, int len)voidreset()longskip(long n)StringtoString()-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Field Detail
-
stream
public ServletInputStream stream
-
request
public HttpServletRequest request
-
-
Constructor Detail
-
LazyRequestInputStream
public LazyRequestInputStream(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:
readLinein classServletInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
-