Package org.apache.commons.net.imap
Class IMAPReply
- java.lang.Object
-
- org.apache.commons.net.imap.IMAPReply
-
public final class IMAPReply extends java.lang.Object
Stores IMAP reply code constants.
-
-
Field Summary
Fields Modifier and Type Field Description static int
BAD
The reply code indicating command rejection.static int
CONT
The reply code indicating command continuation.private static java.lang.String
IMAP_BAD
The IMAP reply String indicating command rejection.private static java.lang.String
IMAP_CONTINUATION_PREFIX
private static java.lang.String
IMAP_NO
The IMAP reply String indicating failure of an operation.private static java.lang.String
IMAP_OK
The IMAP reply String indicating success of an operation.private static java.lang.String
IMAP_UNTAGGED_PREFIX
private static java.util.regex.Pattern
LITERAL_PATTERN
static int
NO
The reply code indicating failure of an operation.static int
OK
The reply code indicating success of an operation.static int
PARTIAL
The reply code indicating a partial response.private static java.util.regex.Pattern
TAGGED_PATTERN
Tag cannot contain: + ( ) { SP CTL % * " \ ]private static java.lang.String
TAGGED_RESPONSE
Guard against Polynomial regular expression used on uncontrolled data.private static java.util.regex.Pattern
UNTAGGED_PATTERN
private static java.lang.String
UNTAGGED_RESPONSE
Guard against Polynomial regular expression used on uncontrolled data.
-
Constructor Summary
Constructors Modifier Constructor Description private
IMAPReply()
Cannot be instantiated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getReplyCode(java.lang.String line)
Interpret the String reply code - OK, NO, BAD - in a tagged response as an integer.private static int
getReplyCode(java.lang.String line, java.util.regex.Pattern pattern)
static int
getUntaggedReplyCode(java.lang.String line)
Interpret the String reply code - OK, NO, BAD - in an untagged response as an integer.static boolean
isContinuation(int replyCode)
Tests whether the reply line is a continuation, i.e.static boolean
isContinuation(java.lang.String line)
Tests whether if the reply line is a continuation, i.e.static boolean
isSuccess(int replyCode)
Tests whether whether the reply code indicates success or notstatic boolean
isUntagged(java.lang.String line)
Tests whether if the reply line is untagged - e.g.static int
literalCount(java.lang.String line)
Checks if the line introduces a literal, i.e.
-
-
-
Field Detail
-
OK
public static final int OK
The reply code indicating success of an operation.- See Also:
- Constant Field Values
-
NO
public static final int NO
The reply code indicating failure of an operation.- See Also:
- Constant Field Values
-
BAD
public static final int BAD
The reply code indicating command rejection.- See Also:
- Constant Field Values
-
CONT
public static final int CONT
The reply code indicating command continuation.- See Also:
- Constant Field Values
-
PARTIAL
public static final int PARTIAL
The 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:
- Constant Field Values
-
IMAP_OK
private static final java.lang.String IMAP_OK
The IMAP reply String indicating success of an operation.- See Also:
- Constant Field Values
-
IMAP_NO
private static final java.lang.String IMAP_NO
The IMAP reply String indicating failure of an operation.- See Also:
- Constant Field Values
-
IMAP_BAD
private static final java.lang.String IMAP_BAD
The IMAP reply String indicating command rejection.- See Also:
- Constant Field Values
-
IMAP_UNTAGGED_PREFIX
private static final java.lang.String IMAP_UNTAGGED_PREFIX
- See Also:
- Constant Field Values
-
IMAP_CONTINUATION_PREFIX
private static final java.lang.String IMAP_CONTINUATION_PREFIX
- See Also:
- Constant Field Values
-
TAGGED_RESPONSE
private static final java.lang.String TAGGED_RESPONSE
Guard against Polynomial regular expression used on uncontrolled data. Don't look for more than 80 letters. Don't look for more than 80 non-whitespace. Don't look for more than 80 character.- See Also:
- Constant Field Values
-
TAGGED_PATTERN
private static final java.util.regex.Pattern TAGGED_PATTERN
Tag cannot contain: + ( ) { SP CTL % * " \ ]
-
UNTAGGED_RESPONSE
private static final java.lang.String UNTAGGED_RESPONSE
Guard against Polynomial regular expression used on uncontrolled data. Don't look for more than 80 backslashes. Don't look for more than 80 character.- See Also:
- Constant Field Values
-
UNTAGGED_PATTERN
private static final java.util.regex.Pattern UNTAGGED_PATTERN
-
LITERAL_PATTERN
private static final java.util.regex.Pattern LITERAL_PATTERN
-
-
Method Detail
-
getReplyCode
public static int getReplyCode(java.lang.String line) throws java.io.IOException
Interpret the String reply code - OK, NO, BAD - in a tagged response as an integer.
-
getReplyCode
private static int getReplyCode(java.lang.String line, java.util.regex.Pattern pattern) throws java.io.IOException
- Throws:
java.io.IOException
-
getUntaggedReplyCode
public static int getUntaggedReplyCode(java.lang.String line) throws java.io.IOException
Interpret the String reply code - OK, NO, BAD - in an untagged response as an integer.
-
isContinuation
public static boolean isContinuation(int replyCode)
Tests whether the reply line is a continuation, i.e. starts with "+"- Parameters:
replyCode
- the code to be checked- Returns:
true
if the response was a continuation
-
isContinuation
public static boolean isContinuation(java.lang.String line)
Tests whether if the reply line is a continuation, i.e. starts with "+"- Parameters:
line
- the line to be checked- Returns:
true
if the line is a continuation
-
isSuccess
public static boolean isSuccess(int replyCode)
Tests whether whether the reply code indicates success or not- Parameters:
replyCode
- the code to check- Returns:
true
if the code equalsOK
-
isUntagged
public static boolean isUntagged(java.lang.String line)
Tests whether if the reply line is untagged - e.g. "* OK ..."- Parameters:
line
- to be checked- Returns:
true
if the line is untagged
-
literalCount
public static int literalCount(java.lang.String line)
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.
-
-