Package org.apache.commons.net.imap
Class IMAPReply
java.lang.Object
org.apache.commons.net.imap.IMAPReply
IMAPReply stores IMAP reply code constants.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe reply code indicating command rejection.static final intThe reply code indicating command continuation.private static final StringThe IMAP reply String indicating command rejection.private static final Stringprivate static final StringThe IMAP reply String indicating failure of an operation.private static final StringThe IMAP reply String indicating success of an operation.private static final Stringprivate static final Patternstatic final intThe reply code indicating failure of an operation.static final intThe reply code indicating success of an operation.static final intThe reply code indicating a partial response.private static final Patternprivate static final Stringprivate static final Patternprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetReplyCode(String line) Interpret the String reply code - OK, NO, BAD - in a tagged response as an integer.private static intgetReplyCode(String line, Pattern pattern) static intgetUntaggedReplyCode(String line) Interpret the String reply code - OK, NO, BAD - in an untagged response as an integer.static booleanisContinuation(int replyCode) Checks if the reply line is a continuation, i.e.static booleanisContinuation(String line) Checks if the reply line is a continuation, i.e.static booleanisSuccess(int replyCode) Checks whether the reply code indicates success or notstatic booleanisUntagged(String line) Checks if the reply line is untagged - e.g.static intliteralCount(String line) Checks if the line introduces a literal, i.e.
-
Field Details
-
OK
public static final int OKThe reply code indicating success of an operation.- See Also:
-
NO
public static final int NOThe reply code indicating failure of an operation.- See Also:
-
BAD
public static final int BADThe reply code indicating command rejection.- See Also:
-
CONT
public static final int CONTThe reply code indicating command continuation.- See Also:
-
PARTIAL
public static final int PARTIALThe reply code indicating a partial response. This is used when a chunk listener is registered and the listener requests that the reply lines are cleared on return.- Since:
- 3.4
- See Also:
-
IMAP_OK
The IMAP reply String indicating success of an operation.- See Also:
-
IMAP_NO
The IMAP reply String indicating failure of an operation.- See Also:
-
IMAP_BAD
The IMAP reply String indicating command rejection.- See Also:
-
IMAP_UNTAGGED_PREFIX
- See Also:
-
IMAP_CONTINUATION_PREFIX
- See Also:
-
TAGGED_RESPONSE
- See Also:
-
TAGGED_PATTERN
-
UNTAGGED_RESPONSE
- See Also:
-
UNTAGGED_PATTERN
-
LITERAL_PATTERN
-
-
Constructor Details
-
IMAPReply
private IMAPReply()Cannot be instantiated.
-
-
Method Details
-
getReplyCode
Interpret the String reply code - OK, NO, BAD - in a tagged response as an integer.- Parameters:
line- the tagged line to be checked- Returns:
OKorNOorBADorCONT- Throws:
IOException- if the input has an unexpected format
-
getReplyCode
- Throws:
IOException
-
getUntaggedReplyCode
Interpret the String reply code - OK, NO, BAD - in an untagged response as an integer.- Parameters:
line- the untagged line to be checked- Returns:
OKorNOorBADorCONT- Throws:
IOException- if the input has an unexpected format
-
isContinuation
public static boolean isContinuation(int replyCode) Checks if the reply line is a continuation, i.e. starts with "+"- Parameters:
replyCode- the code to be checked- Returns:
trueif the response was a continuation
-
isContinuation
Checks if the reply line is a continuation, i.e. starts with "+"- Parameters:
line- the line to be checked- Returns:
trueif the line is a continuation
-
isSuccess
public static boolean isSuccess(int replyCode) Checks whether the reply code indicates success or not- Parameters:
replyCode- the code to check- Returns:
trueif the code equalsOK
-
isUntagged
Checks if the reply line is untagged - e.g. "* OK ..."- Parameters:
line- to be checked- Returns:
trueif the line is untagged
-
literalCount
Checks if the line introduces a literal, i.e. ends with {dd}- Parameters:
line- the line to check- Returns:
- the literal count, or -1 if there was no literal.
-