Class IMAPInputStream

    • Constructor Detail

      • IMAPInputStream

        public IMAPInputStream​(IMAPMessage msg,
                               String section,
                               int max,
                               boolean peek)
        Create an IMAPInputStream.
        Parameters:
        msg - the IMAPMessage the data will come from
        section - the IMAP section/part identifier for the data
        max - the number of bytes in this section
        peek - peek instead of fetch?
    • Method Detail

      • read

        public int read()
                 throws IOException
        Reads the next byte of data from this buffered input stream. If no byte is available, the value -1 is returned.
        Specified by:
        read in class InputStream
        Throws:
        IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws IOException
        Reads up to len bytes of data from this input stream into the given buffer.

        Returns the total number of bytes read into the buffer, or -1 if there is no more data.

        Note that this method mimics the "weird !" semantics of BufferedInputStream in that the number of bytes actually returned may be less that the requested value. So callers of this routine should be aware of this and must check the return value to insure that they have obtained the requisite number of bytes.

        Overrides:
        read in class InputStream
        Throws:
        IOException
      • read

        public int read​(byte[] b)
                 throws IOException
        Reads up to b.length bytes of data from this input stream into an array of bytes.

        Returns the total number of bytes read into the buffer, or -1 is there is no more data.

        Note that this method mimics the "weird !" semantics of BufferedInputStream in that the number of bytes actually returned may be less that the requested value. So callers of this routine should be aware of this and must check the return value to insure that they have obtained the requisite number of bytes.

        Overrides:
        read in class InputStream
        Throws:
        IOException