|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
org.abstracthorizon.danube.http.HTTPBufferedInputStream
public class HTTPBufferedInputStream
This is buffered http input stream. It knows how to read chuncked encoding.
| Field Summary | |
|---|---|
protected byte[] |
buffer
Buffer |
protected int |
bufferSize
Buffer size |
protected boolean |
chunkEncoding
Chunk encoding |
protected int |
chunkSize
Current chunk size |
protected boolean |
closed
Is closed |
protected long |
contentLength
Content length limit |
static int |
DEFAULT_BUFFER_SIZE
Default buffer size to be used when operating in not buffered mode (close and skip methods, for instance) |
protected InputStream |
inputStream
Input stream |
protected int |
len
Amount of bytes in the buffer |
protected int |
mark
Mark |
protected int |
ptr
Pointer in the buffer |
protected int |
readbytes
Number of sent bytes |
| Constructor Summary | |
|---|---|
HTTPBufferedInputStream(InputStream inputStream,
int defaultBufferSize)
Constructor |
|
| Method Summary | |
|---|---|
int |
available()
|
protected void |
checkBuffer()
Checks if buffer is empty and fills it in if needed |
void |
close()
|
int |
getBufferSize()
Returns buffer size |
long |
getContentLength()
Returns limited content length |
boolean |
isChunkEncoding()
Returns if chunk encoding |
void |
mark(int i)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] buf)
|
int |
read(byte[] buf,
int off,
int l)
|
protected int |
readChunkSize()
Read chunk size |
void |
reset()
|
void |
resetInternals()
Resets internals |
void |
setBufferSize(int size)
Sets buffer size |
void |
setChunkEncoding(boolean chunkEncoding)
Sets chunk encoding |
void |
setContentLength(long contentLength)
Sets content length |
long |
skip(long l)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_BUFFER_SIZE
protected byte[] buffer
protected int ptr
protected int len
protected int mark
protected InputStream inputStream
protected int bufferSize
protected boolean closed
protected long contentLength
protected int readbytes
protected boolean chunkEncoding
protected int chunkSize
| Constructor Detail |
|---|
public HTTPBufferedInputStream(InputStream inputStream,
int defaultBufferSize)
intputStream - wrapped input streamdefaultBufferSize - default buffer size| Method Detail |
|---|
public void resetInternals()
public int getBufferSize()
public void setBufferSize(int size)
size - buffer size
IOException - io exceptionpublic long getContentLength()
public void setContentLength(long contentLength)
contentLength - content lengthpublic boolean isChunkEncoding()
public void setChunkEncoding(boolean chunkEncoding)
chunkEncoding - is chunk encoding
protected int readChunkSize()
throws IOException
IOException
protected void checkBuffer()
throws IOException
IOException
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException
public int read()
throws IOException
read in class InputStreamIOException
public int read(byte[] buf)
throws IOException
read in class InputStreamIOException
public int read(byte[] buf,
int off,
int l)
throws IOException
read in class InputStreamIOException
public long skip(long l)
throws IOException
skip in class InputStreamIOException
public int available()
throws IOException
available in class InputStreamIOExceptionpublic void mark(int i)
mark in class InputStream
public void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||