|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.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 sizeMethod 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 encodingprotected int readChunkSize() throws IOException
IOException
protected void checkBuffer() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] buf) throws IOException
read
in class InputStream
IOException
public int read(byte[] buf, int off, int l) throws IOException
read
in class InputStream
IOException
public long skip(long l) throws IOException
skip
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void mark(int i)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |