Top Description Fields Constructors Methods
com.sun.mail.imap.protocol

public Class FetchResponse

extends IMAPResponse
Class Inheritance
Imports
java.io.*, java.util.*, com.sun.mail.util.ASCIIUtility, com.sun.mail.iap.*

This class represents a FETCH response obtained from the input stream of an IMAP server.
Authors
John Mani, Bill Shannon

Field Summary

Modifier and TypeField and Description
private Map<String, Object>
private final FetchItem[]
private static final char[]
private Item[]
private static final char[]

Constructor Summary

AccessConstructor and Description
public
public
public
FetchResponse(IMAPResponse
the IMAPResponse
r
,
FetchItem[]
the fetch items
fitems
)

Construct a FetchResponse that handles the additional FetchItems.

Method Summary

Modifier and TypeMethod and Description
public Map<String, Object>

Returns:

Map of extension items, or null if none
getExtensionItems
()

Return a map of the extension items found in this fetch response.

public Item
getItem(int index)

public <T extends Item> T
getItem(Class<T> c)

public static <
the type of fetch item
T extends Item
>
T

Returns:

the fetch item
getItem
(Response[]
the responses
r
,
int
the message number
msgno
,
Class<T>
the class
c
)

Return the first fetch response item of the given class for the given message number.

public int
public static <
the type of fetch items
T extends Item
>
List<T>

Returns:

the list of fetch items
getItems
(Response[]
the responses
r
,
int
the message number
msgno
,
Class<T>
the class
c
)

Return all fetch response items of the given class for the given message number.

private boolean
match(char[] itemName)

Does the current buffer match the given item name?

private boolean
match(String itemName)

Does the current buffer match the given item name?

private String
next20()

Return the next 20 characters in the buffer, for exception messages.

private void
private boolean
parseExtensionItem()

If this item is a known extension item, parse it.

private Item
parseItem()

Parse the item at the current position in the buffer, skipping over the item if successful.

Inherited from com.sun.mail.imap.protocol.IMAPResponse:
getKeygetNumberkeyEqualsreadSimpleList

Field Detail

extensionItemsback to summary
private Map<String, Object> extensionItems
fitemsback to summary
private final FetchItem[] fitems
itemsback to summary
private Item[] items
TEXTback to summary
private static final char[] TEXT

Constructor Detail

FetchResponseback to summary
public FetchResponse(Protocol p) throws IOException, ProtocolException
FetchResponseback to summary
public FetchResponse(IMAPResponse r) throws IOException, ProtocolException
FetchResponseback to summary
public FetchResponse(IMAPResponse r, FetchItem[] fitems) throws IOException, ProtocolException

Construct a FetchResponse that handles the additional FetchItems.

Parameters
r:IMAPResponse

the IMAPResponse

fitems:FetchItem[]

the fetch items

Exceptions
IOException:
for I/O errors
ProtocolException:
for protocol failures
Since
JavaMail 1.4.6

Method Detail

getExtensionItemsback to summary
public Map<String, Object> getExtensionItems()

Return a map of the extension items found in this fetch response. The map is indexed by extension item name. Callers should not modify the map.

Returns:Map<String, Object>

Map of extension items, or null if none

Since
JavaMail 1.4.6
getItemback to summary
public Item getItem(int index)
getItemback to summary
public <T extends Item> T getItem(Class<T> c)
getItemback to summary
public static <T extends Item> T getItem(Response[] r, int msgno, Class<T> c)

Return the first fetch response item of the given class for the given message number.

Parameters
<T>
the type of fetch item
r:Response[]

the responses

msgno:int

the message number

c:Class<T>

the class

Returns:T

the fetch item

getItemCountback to summary
public int getItemCount()
getItemsback to summary
public static <T extends Item> List<T> getItems(Response[] r, int msgno, Class<T> c)

Return all fetch response items of the given class for the given message number.

Parameters
<T>
the type of fetch items
r:Response[]

the responses

msgno:int

the message number

c:Class<T>

the class

Returns:List<T>

the list of fetch items

Since
JavaMail 1.5.2
matchback to summary
private boolean match(char[] itemName)

Does the current buffer match the given item name? itemName is the name of the IMAP item to compare against. NOTE that itemName *must* be all uppercase. If the match is successful, the buffer pointer (index) is incremented past the matched item.

matchback to summary
private boolean match(String itemName)

Does the current buffer match the given item name? itemName is the name of the IMAP item to compare against. NOTE that itemName *must* be all uppercase. If the match is successful, the buffer pointer (index) is incremented past the matched item.

next20back to summary
private String next20()

Return the next 20 characters in the buffer, for exception messages.

parseback to summary
private void parse() throws ParsingException

Hides com.sun.mail.iap.Response.parse.

parseExtensionItemback to summary
private boolean parseExtensionItem() throws ParsingException

If this item is a known extension item, parse it.

parseItemback to summary
private Item parseItem() throws ParsingException

Parse the item at the current position in the buffer, skipping over the item if successful. Otherwise, return null and leave the buffer position unmodified.

Annotations
@SuppressWarnings:empty