org.apache.commons.net.imap
Class IMAPReply

java.lang.Object
  extended by org.apache.commons.net.imap.IMAPReply

public final class IMAPReply
extends Object

IMAPReply stores IMAP reply code constants.


Field Summary
static int BAD
          The reply code indicating command rejection.
static int CONT
          The reply code indicating command continuation.
static int NO
          The reply code indicating failure of an operation.
static int OK
          The reply code indicating success of an operation.
 
Method Summary
static int getReplyCode(String line)
          Intepret the String reply code - OK, NO, BAD - in a tagged response as a integer.
static int getUntaggedReplyCode(String line)
          Intepret the String reply code - OK, NO, BAD - in an untagged response as a integer.
static boolean isContinuation(int replyCode)
          Checks if the reply line is a continuation, i.e.
static boolean isContinuation(String line)
          Checks if the reply line is a continuation, i.e.
static boolean isSuccess(int replyCode)
          Checks whether the reply code indicates success or not
static boolean isUntagged(String line)
          Checks if the reply line is untagged - e.g.
static int literalCount(String line)
          Checks if the line introduces a literal, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Method Detail

isUntagged

public static boolean isUntagged(String line)
Checks if the reply line is untagged - e.g. "* OK ..."

Parameters:
line - to be checked
Returns:
true if the line is untagged

isContinuation

public static boolean isContinuation(String line)
Checks if the reply line is a continuation, i.e. starts with "+"

Parameters:
line - the line to be checked
Returns:
true if the line is untagged

getReplyCode

public static int getReplyCode(String line)
                        throws IOException
Intepret the String reply code - OK, NO, BAD - in a tagged response as a integer.

Parameters:
line - the tagged line to be checked
Returns:
OK or NO or BAD or CONT
Throws:
IOException - if the input has an unexpected format

literalCount

public static int literalCount(String line)
Checks if the line introduces a literal, i.e. ends with {dd}

Returns:
the literal count, or -1 if there was no literal.

getUntaggedReplyCode

public static int getUntaggedReplyCode(String line)
                                throws IOException
Intepret the String reply code - OK, NO, BAD - in an untagged response as a integer.

Parameters:
line - the untagged line to be checked
Returns:
OK or NO or BAD or CONT
Throws:
IOException - if the input has an unexpected format

isSuccess

public static boolean isSuccess(int replyCode)
Checks whether the reply code indicates success or not

Parameters:
replyCode - the code to check
Returns:
true if the code equals OK

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:
true if the response was a continuation


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.