public class MultipartStream.ItemInputStream extends java.io.InputStream implements Closeable
InputStream for reading an items contents.| Modifier and Type | Field and Description |
|---|---|
private static int |
BYTE_POSITIVE_OFFSET
Offset when converting negative bytes to integers.
|
private boolean |
closed
Whether the stream is already closed.
|
private int |
pad
The number of bytes, which must be hold, because
they might be a part of the boundary.
|
private int |
pos
The current offset in the buffer.
|
private long |
total
The number of bytes, which have been read so far.
|
| Constructor and Description |
|---|
ItemInputStream()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns the number of bytes, which are currently
available, without blocking.
|
void |
close()
Closes the input stream.
|
void |
close(boolean pCloseUnderlying)
Closes the input stream.
|
private void |
findSeparator()
Called for finding the separator.
|
long |
getBytesRead()
Returns the number of bytes, which have been read
by the stream.
|
boolean |
isClosed()
Returns, whether the stream is closed.
|
private int |
makeAvailable()
Attempts to read more data.
|
int |
read()
Returns the next byte in the stream.
|
int |
read(byte[] b,
int off,
int len)
Reads bytes into the given buffer.
|
long |
skip(long bytes)
Skips the given number of bytes.
|
private long total
private int pad
private int pos
private boolean closed
private static final int BYTE_POSITIVE_OFFSET
private void findSeparator()
public long getBytesRead()
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException - An I/O error occurs.public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - An I/O error occurred.public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamb - The destination buffer, where to write to.off - Offset of the first byte in the buffer.len - Maximum number of bytes to read.java.io.IOException - An I/O error occurred.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException - An I/O error occurred.public void close(boolean pCloseUnderlying)
throws java.io.IOException
pCloseUnderlying - Whether to close the underlying stream
(hard close)java.io.IOException - An I/O error occurred.public long skip(long bytes)
throws java.io.IOException
skip in class java.io.InputStreambytes - Number of bytes to skip.java.io.IOException - An I/O error occurred.private int makeAvailable()
throws java.io.IOException
java.io.IOException - An I/O error occurred.public boolean isClosed()