# Class MultipartInput.ItemInputStream

java.lang.Object
java.io.InputStream
org.apache.commons.fileupload2.core.MultipartInput.ItemInputStream

All Implemented Interfaces:
  `Closeable, AutoCloseable`

Enclosing class:
  `MultipartInput`

public class MultipartInput.ItemInputStream extends InputStream
An `InputStream` for reading an items contents.

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
Returns the number of bytes, which are currently available, without blocking.
`void`
`close()`
Closes the input stream.
`void`
`close(boolean closeUnderlying)`
Closes the input stream.
`long`
`getBytesRead()`
Gets the number of bytes, which have been read by the stream.
`boolean`
`isClosed()`
Tests whether this instance is closed.
`int`
`read()`
Reads 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.

### Methods inherited from class InputStream

`mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, transferTo`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### available

public int available() throws IOException
Returns the number of bytes, which are currently available, without blocking.

Overrides:
  `available` in class `InputStream`
Returns:
  Number of bytes in the buffer.
Throws:
  `IOException` - An I/O error occurs.

### close

public void close() throws IOException
Closes the input stream.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `InputStream`
Throws:
  `IOException` - An I/O error occurred.

### close

public void close(boolean closeUnderlying) throws IOException
Closes the input stream.

Parameters:
  `closeUnderlying` - Whether to close the underlying stream (hard close)
Throws:
  `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 IOException
Reads the next byte in the stream.

Specified by:
  `read` in class `InputStream`
Returns:
  The next byte in the stream, as a non-negative integer, or -1 for EOF.
Throws:
  `IOException` - An I/O error occurred.

### read

public int read(byte[] b, int off, int len) throws IOException
Reads bytes into the given buffer.

Overrides:
  `read` in class `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:
  `IOException` - An I/O error occurred.

### skip

public long skip(long bytes) throws IOException
Skips the given number of bytes.

Overrides:
  `skip` in class `InputStream`
Parameters:
  `bytes` - Number of bytes to skip.
Returns:
  The number of bytes, which have actually been skipped.
Throws:
  `IOException` - An I/O error occurred.