public abstract class ImapRequestLineReader extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ImapRequestLineReader.ATOM_CHARValidator |
static interface |
ImapRequestLineReader.CharacterValidator
Provides the ability to ensure characters are part of a permitted set.
|
static class |
ImapRequestLineReader.MessageSetCharValidator |
static class |
ImapRequestLineReader.NoopCharValidator |
static class |
ImapRequestLineReader.TagCharValidator |
Modifier and Type | Field and Description |
---|---|
protected char |
nextChar |
protected boolean |
nextSeen |
Constructor and Description |
---|
ImapRequestLineReader() |
Modifier and Type | Method and Description |
---|---|
String |
astring()
Reads an argument of type "astring" from the request.
|
String |
astring(Charset charset)
Reads an argument of type "astring" from the request.
|
String |
atom()
Reads an argument of type "atom" from the request.
|
static int |
cap(char next) |
protected abstract void |
commandContinuationRequest()
Sends a server command continuation request '+' back to the client,
requesting more data to be sent.
|
char |
consume()
Consumes the current character in the reader, so that subsequent calls to
the request will provide a new character.
|
void |
consumeChar(char expected)
Consumes the next character in the request, checking that it matches the
expected one.
|
void |
consumeLine()
Consume the rest of the line
|
InputStream |
consumeLiteral(boolean extraCRLF) |
String |
consumeLiteral(Charset charset)
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 '{'.
|
String |
consumeQuoted()
Reads a quoted string value from the request.
|
protected String |
consumeQuoted(Charset charset)
Reads a quoted string value from the request.
|
String |
consumeWord(ImapRequestLineReader.CharacterValidator validator)
Reads the next "word from the request, comprising all characters up to
the next SPACE.
|
DayMonthYear |
date()
Reads one
date argument from the request. |
Date |
dateTime()
Reads a "date-time" argument from the request.
|
void |
eol()
Moves the request line reader to end of the line, checking that no
non-space character are found.
|
javax.mail.Flags |
flag()
Reads a "flag" argument from the request.
|
javax.mail.Flags |
flagList()
Reads a "flags-list" argument from the request.
|
static boolean |
isCHAR(char chr) |
static boolean |
isListWildcard(char chr) |
static boolean |
isQuotedSpecial(char chr) |
String |
mailbox()
Reads the mailbox name via
mailboxUTF7() but also decode it via CharsetUtil.decodeModifiedUTF7(String)
If you really want to get the modified UTF7 version you should use mailboxUTF7() |
String |
mailboxUTF7()
Reads a "mailbox" argument from the request.
|
abstract char |
nextChar()
Reads the next character in the current line.
|
char |
nextWordChar()
Reads the next regular, non-space character in the current line.
|
String |
nstring()
Reads an argument of type "nstring" from the request.
|
long |
number()
Calls
number() with argument of false |
long |
number(boolean stopOnParen)
Reads an argument of type "number" from the request
|
long |
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".
|
IdRange[] |
parseIdRange()
Reads a "message set" argument, and parses into an IdSet.
|
IdRange[] |
parseIdRange(ImapSession session)
Reads a "message set" argument, and parses into an IdSet.
|
abstract InputStream |
read(int size,
boolean extraCRLF)
Reads and consumes a number of characters from the underlying reader,
filling the char array provided.
|
String |
tag()
Reads a command "tag" from the request.
|
public static int cap(char next)
public char nextWordChar() throws DecodingException
DecodingException
to be thrown. This method will continue to
return the same character until the consume()
method is called.DecodingException
- If the end-of-line or end-of-stream is reached.public abstract char nextChar() throws DecodingException
consume()
method is
called.DecodingException
- If the end-of-stream is reached.public void eol() throws DecodingException
DecodingException
- If more non-space tokens are found in this line, or the
end-of-file is reached.public char consume() throws DecodingException
DecodingException
- if a the current character can't be obtained (eg we're at
end-of-file).public abstract InputStream read(int size, boolean extraCRLF) throws DecodingException
size
- count of characters to read and consumeextraCRLF
- true
if extra CRLF is wanted, false
elseDecodingException
- If a char can't be read into each array element.protected abstract void commandContinuationRequest() throws DecodingException
DecodingException
public void consumeLine() throws DecodingException
DecodingException
public String atom() throws DecodingException
DecodingException
public String tag() throws DecodingException
DecodingException
public String astring() throws DecodingException
DecodingException
public String astring(Charset charset) throws DecodingException
DecodingException
public String nstring() throws DecodingException
DecodingException
public String mailbox() throws DecodingException
mailboxUTF7()
but also decode it via CharsetUtil.decodeModifiedUTF7(String)
If you really want to get the modified UTF7 version you should use mailboxUTF7()
DecodingException
public String mailboxUTF7() throws DecodingException
DecodingException
public DayMonthYear date() throws DecodingException
date
argument from the request.DayMonthYear
, not nullDecodingException
public Date dateTime() throws DecodingException
DecodingException
public String consumeWord(ImapRequestLineReader.CharacterValidator validator) throws DecodingException
DecodingException
public String consumeLiteral(Charset charset) throws DecodingException
charset
- , or null for US-ASCII
DecodingException
public InputStream consumeLiteral(boolean extraCRLF) throws DecodingException
DecodingException
public void consumeChar(char expected) throws DecodingException
DecodingException
public String consumeQuoted() throws DecodingException
DecodingException
protected String consumeQuoted(Charset charset) throws DecodingException
DecodingException
public javax.mail.Flags flagList() throws DecodingException
DecodingException
public javax.mail.Flags flag() throws DecodingException
DecodingException
public long number() throws DecodingException
number()
with argument of falseDecodingException
public long number(boolean stopOnParen) throws DecodingException
stopOnParen
- true if it should stop to parse on the first closing parenDecodingException
public long nzNumber() throws DecodingException
DecodingException
public static boolean isCHAR(char chr)
public static boolean isListWildcard(char chr)
public static boolean isQuotedSpecial(char chr)
public IdRange[] parseIdRange() throws DecodingException
DecodingException
public IdRange[] parseIdRange(ImapSession session) throws DecodingException
DecodingException
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.