play.data.parsing
Class MultipartStream.ItemInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by play.data.parsing.MultipartStream.ItemInputStream
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
MultipartStream

public class MultipartStream.ItemInputStream
extends java.io.InputStream
implements org.apache.commons.fileupload.util.Closeable

An InputStream for reading an items contents.


Method Summary
 int available()
          Returns the number of bytes, which are currently available, without blocking.
 void close()
          Closes the input stream.
 long getBytesRead()
          Returns the number of bytes, which have been read by the stream.
 boolean isClosed()
          Returns, whether the stream is closed.
 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.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBytesRead

public long getBytesRead()
Returns the number of bytes, which have been read by the stream.

Returns:
Number of bytes, which have been read so far.

available

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

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

read

public int read()
         throws java.io.IOException
Returns the next byte in the stream.

Specified by:
read in class java.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:
read in class java.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.

close

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

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
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:
skip in class java.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.

isClosed

public boolean isClosed()
Returns, whether the stream is closed.

Returns:
True, if the stream is closed, otherwise false.


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly