com.sun.mail.imap
Class IMAPInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.mail.imap.IMAPInputStream
All Implemented Interfaces:
java.io.Closeable

public class IMAPInputStream
extends java.io.InputStream

This class implements an IMAP data stream.

Author:
John Mani

Constructor Summary
IMAPInputStream(IMAPMessage msg, java.lang.String section, int max, boolean peek)
          Create an IMAPInputStream.
 
Method Summary
 int available()
          Returns the number of bytes that can be read from this input stream without blocking.
 int read()
          Reads the next byte of data from this buffered input stream.
 int read(byte[] b)
          Reads up to b.length bytes of data from this input stream into an array of bytes.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this input stream into the given buffer.
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IMAPInputStream

public IMAPInputStream(IMAPMessage msg,
                       java.lang.String section,
                       int max,
                       boolean peek)
Create an IMAPInputStream.

Method Detail

read

public int read()
         throws java.io.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 java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.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 java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.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 java.io.InputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read from this input stream without blocking.

Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException


Copyright © 2012. All Rights Reserved.