Class IMAPReply


  • public final class IMAPReply
    extends java.lang.Object
    IMAPReply 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  
      private static java.lang.String TAGGED_RESPONSE  
      private static java.util.regex.Pattern UNTAGGED_PATTERN  
      private static java.lang.String UNTAGGED_RESPONSE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private IMAPReply()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getReplyCode​(java.lang.String line)
      Intepret the String reply code - OK, NO, BAD - in a tagged response as a integer.
      private static int getReplyCode​(java.lang.String line, java.util.regex.Pattern pattern)  
      static int getUntaggedReplyCode​(java.lang.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​(java.lang.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​(java.lang.String line)
      Checks if the reply line is untagged - e.g.
      static int literalCount​(java.lang.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
      • 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_PATTERN

        private static final java.util.regex.Pattern TAGGED_PATTERN
      • UNTAGGED_RESPONSE

        private static final java.lang.String UNTAGGED_RESPONSE
        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
    • Constructor Detail

      • IMAPReply

        private IMAPReply()
    • Method Detail

      • isUntagged

        public static boolean isUntagged​(java.lang.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​(java.lang.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​(java.lang.String line)
                                throws java.io.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:
        java.io.IOException - if the input has an unexpected format
      • 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.
      • getUntaggedReplyCode

        public static int getUntaggedReplyCode​(java.lang.String line)
                                        throws java.io.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:
        java.io.IOException - if the input has an unexpected format
      • getReplyCode

        private static int getReplyCode​(java.lang.String line,
                                        java.util.regex.Pattern pattern)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • 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