Package org.jboss.resteasy.client.core
Class SelfExpandingBufferredInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.BufferedInputStream
-
- org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
ApacheHttpClient4Executor.ResponseStream
public class SelfExpandingBufferredInputStream extends java.io.BufferedInputStream
Extension ofBufferedInputStream
enforcing the contract where reset() always returns to the beginning of the stream, and the internal buffer expands automatically to the total length of content read from the underlying stream.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
defaultBufferSize
-
Constructor Summary
Constructors Constructor Description SelfExpandingBufferredInputStream(java.io.InputStream in)
SelfExpandingBufferredInputStream(java.io.InputStream in, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
expand()
Double the current buffer size limit.int
getBufSize()
Return the current maximum size of the internal buffer.int
getCount()
int
getMarkLimit()
int
getMarkPos()
int
getPos()
void
mark(int readlimit)
Not supported.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
-
Methods inherited from class java.io.BufferedInputStream
available, close, markSupported, reset, skip
-
-
-
-
Method Detail
-
mark
public void mark(int readlimit)
Not supported. Mark position is always zero.- Overrides:
mark
in classjava.io.BufferedInputStream
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.BufferedInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.BufferedInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
expand
private void expand() throws java.io.IOException
Double the current buffer size limit. Reset to zero, then double the buffer size and restore last position in the buffer.- Throws:
java.io.IOException
-
getBufSize
public int getBufSize()
Return the current maximum size of the internal buffer. This is independent of how much data is actually contained within the buffer.
-
getCount
public int getCount()
-
getPos
public int getPos()
-
getMarkLimit
public int getMarkLimit()
-
getMarkPos
public int getMarkPos()
-
-