Class CommandParser
java.lang.Object
com.icegreen.greenmail.imap.commands.CommandParser
- Version:
- $Revision: 109034 $ QuickFix: Additional date parsing procedures was added in the dateTime method (2009-02-04)
- Author:
- Darrell DeBoer <darrell@apache.org>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected static interface
Provides the ability to ensure characters are part of a permitted set.protected class
protected class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionastring
(ImapRequestLineReader request) Reads an argument of type "astring" from the request.atom
(ImapRequestLineReader request) Reads an argument of type "atom" from the request.byte[]
base64
(ImapRequestLineReader request) Reads a base64 argument from the request.protected void
consumeChar
(ImapRequestLineReader request, char expected) Consumes the next character in the request, checking that it matches the expected one.protected String
consumeLiteral
(ImapRequestLineReader request) Reads an argument of type "literal" from the request, in the format: "{" charCount "}" CRLF *CHAR8 Note before calling, the request should be positioned so that nextChar is '{'.protected String
consumeQuoted
(ImapRequestLineReader request) Reads a quoted string value from the request.protected String
consumeWord
(ImapRequestLineReader request, CommandParser.CharacterValidator validator) Reads the next "word from the request, comprising all characters up to the next SPACE.date
(ImapRequestLineReader request) Reads a "date" argument from the request.dateTime
(ImapRequestLineReader request) Reads a "date-time" argument from the request.void
endLine
(ImapRequestLineReader request) Consumes the request up to and including the eno-of-line.javax.mail.Flags
flagList
(ImapRequestLineReader request) Reads a "flags" argument from the request.protected boolean
isListWildcard
(char chr) mailbox
(ImapRequestLineReader request) Reads a "mailbox" argument from the request.nstring
(ImapRequestLineReader request) Reads an argument of type "nstring" from the request.long
number
(ImapRequestLineReader request) Reads an argument of type "number" from the request.long
nzNumber
(ImapRequestLineReader request) Reads an argument of type "nznumber" (a non-zero number) (NOTE this isn't strictly as per the spec, since the spec disallows numbers such as "0123" as nzNumbers (although it's ok as a "number".IdRange[]
parseIdRange
(ImapRequestLineReader request) Reads a "message set" argument, and parses into an IdSet.void
tag
(ImapRequestLineReader request) Reads a command "tag" from the request.
-
Field Details
-
log
protected final org.slf4j.Logger logNew logger.
-
-
Constructor Details
-
CommandParser
public CommandParser()
-
-
Method Details
-
atom
Reads an argument of type "atom" from the request.- Throws:
ProtocolException
-
tag
Reads a command "tag" from the request.- Throws:
ProtocolException
-
astring
Reads an argument of type "astring" from the request.- Throws:
ProtocolException
-
nstring
Reads an argument of type "nstring" from the request.- Throws:
ProtocolException
-
mailbox
Reads a "mailbox" argument from the request. Not implemented *exactly* as per spec, since a quoted or literal "inbox" still yeilds "INBOX" (ie still case-insensitive if quoted or literal). I think this makes sense. mailbox ::= "INBOX" / astring ;; INBOX is case-insensitive. All case variants of ;; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX ;; not as an astring.- Throws:
ProtocolException
-
dateTime
Reads a "date-time" argument from the request. TODO handle timezones properly- Throws:
ProtocolException
-
date
Reads a "date" argument from the request. TODO handle timezones properly- Throws:
ProtocolException
-
consumeWord
protected String consumeWord(ImapRequestLineReader request, CommandParser.CharacterValidator validator) throws ProtocolException Reads the next "word from the request, comprising all characters up to the next SPACE. Characters are tested by the supplied CharacterValidator, and an exception is thrown if invalid characters are encountered.- Throws:
ProtocolException
-
consumeLiteral
Reads an argument of type "literal" from the request, in the format: "{" charCount "}" CRLF *CHAR8 Note before calling, the request should be positioned so that nextChar is '{'. Leading whitespace is not skipped in this method.- Throws:
ProtocolException
-
consumeChar
Consumes the next character in the request, checking that it matches the expected one. This method should be used when the- Throws:
ProtocolException
-
consumeQuoted
Reads a quoted string value from the request.- Throws:
ProtocolException
-
base64
Reads a base64 argument from the request.- Throws:
ProtocolException
-
flagList
Reads a "flags" argument from the request.- Throws:
ProtocolException
-
setFlag
- Throws:
ProtocolException
-
number
Reads an argument of type "number" from the request.- Throws:
ProtocolException
-
nzNumber
Reads an argument of type "nznumber" (a non-zero number) (NOTE this isn't strictly as per the spec, since the spec disallows numbers such as "0123" as nzNumbers (although it's ok as a "number". I think the spec is a bit shonky.)- Throws:
ProtocolException
-
isListWildcard
protected boolean isListWildcard(char chr) -
endLine
Consumes the request up to and including the eno-of-line.- Parameters:
request
- The request- Throws:
ProtocolException
- If characters are encountered before the endLine.
-
parseIdRange
Reads a "message set" argument, and parses into an IdSet. Currently only supports a single range of values.- Throws:
ProtocolException
-