Class MultipartStream.MultipartItemInputStream

  • All Implemented Interfaces:
    com.helger.commons.state.ICloseable, Closeable, AutoCloseable
    Enclosing class:
    MultipartStream

    public final class MultipartStream.MultipartItemInputStream
    extends InputStream
    implements com.helger.commons.state.ICloseable
    An InputStream for reading an items contents.
    • 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 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.
      • read

        public int read()
                 throws IOException
        Returns 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[] aBuf,
                        int nOfs,
                        int nLen)
                 throws IOException
        Reads bytes into the given buffer.
        Overrides:
        read in class InputStream
        Parameters:
        aBuf - The destination buffer, where to write to.
        nOfs - Offset of the first byte in the buffer.
        nLen - 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.
      • close

        public void close()
                   throws IOException
        Closes the input stream but NOT the underlying InputStream.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface com.helger.commons.state.ICloseable
        Overrides:
        close in class InputStream
        Throws:
        IOException - An I/O error occurred.
      • close

        public void close​(boolean bCloseUnderlying)
                   throws IOException
        Closes the input stream.
        Parameters:
        bCloseUnderlying - Whether to close the underlying stream (hard close)
        Throws:
        IOException - An I/O error occurred.
      • skip

        public long skip​(long nBytes)
                  throws IOException
        Skips the given number of bytes.
        Overrides:
        skip in class InputStream
        Parameters:
        nBytes - Number of bytes to skip.
        Returns:
        The number of bytes, which have actually been skipped.
        Throws:
        IOException - An I/O error occurred.
      • isClosed

        public boolean isClosed()
        Returns, whether the stream is closed.
        Specified by:
        isClosed in interface com.helger.commons.state.ICloseable
        Returns:
        True, if the stream is closed, otherwise false.