Class IMAPInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.sun.mail.imap.IMAPInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class IMAPInputStream extends InputStream
This class implements an IMAP data stream.- Author:
- John Mani
-
-
Constructor Summary
Constructors Constructor Description IMAPInputStream(IMAPMessage msg, String section, int max, boolean peek)Create an IMAPInputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()Returns the number of bytes that can be read from this input stream without blocking.intread()Reads the next byte of data from this buffered input stream.intread(byte[] b)Reads up tob.lengthbytes of data from this input stream into an array of bytes.intread(byte[] b, int off, int len)Reads up tolenbytes of data from this input stream into the given buffer.-
Methods inherited from class java.io.InputStream
close, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
IMAPInputStream
public IMAPInputStream(IMAPMessage msg, String section, int max, boolean peek)
Create an IMAPInputStream.- Parameters:
msg- the IMAPMessage the data will come fromsection- the IMAP section/part identifier for the datamax- the number of bytes in this sectionpeek- peek instead of fetch?
-
-
Method Detail
-
read
public int read() throws IOExceptionReads the next byte of data from this buffered input stream. If no byte is available, the value-1is returned.- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOExceptionReads up tolenbytes of data from this input stream into the given buffer.Returns the total number of bytes read into the buffer, or
-1if 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:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOExceptionReads up tob.lengthbytes of data from this input stream into an array of bytes.Returns the total number of bytes read into the buffer, or
-1is 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:
readin classInputStream- Throws:
IOException
-
available
public int available() throws IOExceptionReturns the number of bytes that can be read from this input stream without blocking.- Overrides:
availablein classInputStream- Throws:
IOException
-
-