Class IMAPReply

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

public final class IMAPReply extends Object
IMAPReply stores IMAP reply code constants.
  • Field Details

    • OK

      public static final int OK
      The reply code indicating success of an operation.
      See Also:
    • NO

      public static final int NO
      The reply code indicating failure of an operation.
      See Also:
    • BAD

      public static final int BAD
      The reply code indicating command rejection.
      See Also:
    • CONT

      public static final int CONT
      The reply code indicating command continuation.
      See Also:
    • 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:
    • IMAP_OK

      private static final String IMAP_OK
      The IMAP reply String indicating success of an operation.
      See Also:
    • IMAP_NO

      private static final String IMAP_NO
      The IMAP reply String indicating failure of an operation.
      See Also:
    • IMAP_BAD

      private static final String IMAP_BAD
      The IMAP reply String indicating command rejection.
      See Also:
    • IMAP_UNTAGGED_PREFIX

      private static final String IMAP_UNTAGGED_PREFIX
      See Also:
    • IMAP_CONTINUATION_PREFIX

      private static final String IMAP_CONTINUATION_PREFIX
      See Also:
    • TAGGED_RESPONSE

      private static final String TAGGED_RESPONSE
      See Also:
    • TAGGED_PATTERN

      private static final Pattern TAGGED_PATTERN
    • UNTAGGED_RESPONSE

      private static final String UNTAGGED_RESPONSE
      See Also:
    • UNTAGGED_PATTERN

      private static final Pattern UNTAGGED_PATTERN
    • LITERAL_PATTERN

      private static final Pattern LITERAL_PATTERN
  • Constructor Details

    • IMAPReply

      private IMAPReply()
      Cannot be instantiated.
  • Method Details

    • getReplyCode

      public static int getReplyCode(String line) throws IOException
      Interpret the String reply code - OK, NO, BAD - in a tagged response as an 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
    • getReplyCode

      private static int getReplyCode(String line, Pattern pattern) throws IOException
      Throws:
      IOException
    • getUntaggedReplyCode

      public static int getUntaggedReplyCode(String line) throws IOException
      Interpret the String reply code - OK, NO, BAD - in an untagged response as an 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
    • 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
    • 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 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:
      true if the code equals OK
    • 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
    • literalCount

      public static int literalCount(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.