public class

IMAPInputStream

extends InputStream
java.lang.Object
   ↳ java.io.InputStream
     ↳ com.google.code.com.sun.mail.imap.IMAPInputStream

Class Overview

This class implements an IMAP data stream.

Summary

Constants
int slop
[Expand]
Inherited Constants
From class java.io.InputStream
Fields
private int blksize
private byte[] buf
private int bufcount
private int bufpos
private int max
private IMAPMessage msg
private boolean peek
private int pos
private ByteArray readbuf
private String section
Public Constructors
IMAPInputStream(IMAPMessage msg, String section, int max, boolean peek)
Create an IMAPInputStream.
Public Methods
synchronized int available()
Returns the number of bytes that can be read from this input stream without blocking.
int read(byte[] b)
Reads up to b.length bytes of data from this input stream into an array of bytes.
synchronized int read()
Reads the next byte of data from this buffered input stream.
synchronized int read(byte[] b, int off, int len)
Reads up to len bytes of data from this input stream into the given buffer.
[Expand]
Inherited Methods
From class java.io.InputStream
From class java.lang.Object
From interface java.io.Closeable

Constants

private static final int slop

Constant Value: 64 (0x00000040)

Fields

private int blksize

private byte[] buf

private int bufcount

private int bufpos

private int max

private IMAPMessage msg

private boolean peek

private int pos

private ByteArray readbuf

private String section

Public Constructors

public IMAPInputStream (IMAPMessage msg, String section, int max, boolean peek)

Create an IMAPInputStream.

Parameters
msg
section
max
peek

Public Methods

public synchronized int available ()

Returns the number of bytes that can be read from this input stream without blocking.

Throws
IOException

public int read (byte[] b)

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.

Parameters
b
Throws
IOException

public synchronized int read ()

Reads the next byte of data from this buffered input stream. If no byte is available, the value -1 is returned.

Throws
IOException

public synchronized int read (byte[] b, int off, int len)

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.

Parameters
b
off
len
Throws
IOException