Class MultipartInput.ItemInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.commons.fileupload2.core.MultipartInput.ItemInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- MultipartInput
public class MultipartInput.ItemInputStream extends java.io.InputStream
AnInputStreamfor reading an items contents.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()Returns the number of bytes, which are currently available, without blocking.voidclose()Closes the input stream.voidclose(boolean closeUnderlying)Closes the input stream.longgetBytesRead()Gets the number of bytes, which have been read by the stream.booleanisClosed()Tests whether this instance is closed.intread()Reads the next byte in the stream.intread(byte[] b, int off, int len)Reads bytes into the given buffer.longskip(long bytes)Skips the given number of bytes.
-
-
-
Method Detail
-
available
public int available() throws java.io.IOException
Returns the number of bytes, which are currently available, without blocking.- Overrides:
availablein classjava.io.InputStream- Returns:
- Number of bytes in the buffer.
- Throws:
java.io.IOException- An I/O error occurs.
-
close
public void close() throws java.io.IOException
Closes the input stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException- An I/O error occurred.
-
close
public void close(boolean closeUnderlying) throws java.io.IOException
Closes the input stream.- Parameters:
closeUnderlying- Whether to close the underlying stream (hard close)- Throws:
java.io.IOException- An I/O error occurred.
-
getBytesRead
public long getBytesRead()
Gets the number of bytes, which have been read by the stream.- Returns:
- Number of bytes, which have been read so far.
-
isClosed
public boolean isClosed()
Tests whether this instance is closed.- Returns:
- whether this instance is closed.
-
read
public int read() throws java.io.IOException
Reads the next byte in the stream.- Specified by:
readin classjava.io.InputStream- Returns:
- The next byte in the stream, as a non-negative integer, or -1 for EOF.
- Throws:
java.io.IOException- An I/O error occurred.
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
Reads bytes into the given buffer.- Overrides:
readin classjava.io.InputStream- Parameters:
b- The destination buffer, where to write to.off- Offset of the first byte in the buffer.len- Maximum number of bytes to read.- Returns:
- Number of bytes, which have been actually read, or -1 for EOF.
- Throws:
java.io.IOException- An I/O error occurred.
-
skip
public long skip(long bytes) throws java.io.IOException
Skips the given number of bytes.- Overrides:
skipin classjava.io.InputStream- Parameters:
bytes- Number of bytes to skip.- Returns:
- The number of bytes, which have actually been skipped.
- Throws:
java.io.IOException- An I/O error occurred.
-
-