|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.geronimo.javamail.store.imap.connection.IMAPCommand
public class IMAPCommand
Utility class for building up what might be complex arguments to a command. This includes the ability to directly write out binary arrays of data and have them constructed as IMAP literals.
Field Summary | |
---|---|
static char[] |
encodingTable
|
protected boolean |
needWhiteSpace
|
protected DataOutputStream |
out
|
protected List |
segments
|
protected ByteArrayOutputStream |
sink
|
protected String |
tag
|
protected static int |
tagCounter
|
Constructor Summary | |
---|---|
IMAPCommand()
Create an empty command. |
|
IMAPCommand(String command)
Create a command with an initial command string. |
Method Summary | |
---|---|
void |
append(String value)
Directly append a value to the buffer without attempting to insert whitespace or figure out any format encodings. |
void |
appendACL(ACL acl)
Append an ACL value to a command. |
void |
appendACL(ACL acl,
String modifier)
Append an ACL value to a command. |
protected void |
appendAnd(AndTerm term,
String charset)
append IMAP search term information from an AndTerm item. |
void |
appendAtom(byte[] value)
Append an atom to the command buffer. |
void |
appendAtom(String value)
Append an atom value to the command. |
protected void |
appendBody(BodyTerm term,
String charset)
append IMAP search term information from a BodyTerm item. |
void |
appendBodySection(String partName)
Append a body section specification to a command string. |
void |
appendBodySection(String section,
String partName)
Append a body section specification to a command string. |
void |
appendDate(Date d)
Format a date into the form required for IMAP commands. |
void |
appendEncodedString(String value)
Append a string value to a command buffer, with encoding. |
void |
appendFetchProfile(FetchProfile profile)
Append a FetchProfile information to an IMAPCommand that's to be issued. |
protected void |
appendFlag(FlagTerm term,
String charset)
append IMAP search term information from a FlagTerm item. |
void |
appendFlags(Flags flags)
Append a set of flags to a command buffer. |
protected void |
appendFrom(FromStringTerm term,
String charset)
append IMAP search term information from a FromStringTerm item. |
protected void |
appendFrom(FromTerm term,
String charset)
append IMAP search term information from a FromTerm item. |
protected void |
appendHeader(HeaderTerm term,
String charset)
append IMAP search term information from a HeaderTerm item. |
void |
appendInteger(int value)
Append an integer value to the command, converting the integer into string form. |
void |
appendLiteral(byte[] value)
Append an IMAP literal values to the command. |
void |
appendLiteral(ByteArrayOutputStream value)
Append literal data to the command where the literal sourcd is a ByteArrayOutputStream. |
protected void |
appendLiteralHeader(int size)
Add a literal header to the buffer. |
void |
appendLong(long value)
Append a long value to the command, converting the integer into string form. |
protected void |
appendMessageID(MessageIDTerm term,
String charset)
append IMAP search term information from a MessageIDTerm item. |
protected void |
appendNot(NotTerm term,
String charset)
append IMAP search term information from a NotTerm item. |
protected void |
appendOr(OrTerm term,
String charset)
append IMAP search term information from an OrTerm item. |
void |
appendQuota(Quota quota)
Append a quota specification to an IMAP command. |
void |
appendQuotaResource(Quota.Resource resource)
Append a Quota.Resource element to an IMAP command. |
void |
appendQuotedString(byte[] value)
Write out a string of literal data, taking into account the need to escape both '"' and '\' characters. |
void |
appendQuotedString(String value)
Append a string value to a command buffer. |
protected void |
appendReceivedDate(ReceivedDateTerm term,
String charset)
append IMAP search term information from a ReceivedDateTerm item. |
protected void |
appendRecipient(RecipientStringTerm term,
String charset)
append IMAP search term information from a RecipientStringTerm item. |
protected void |
appendRecipient(RecipientTerm term,
String charset)
append IMAP search term information from a RecipientTerm item. |
void |
appendSearchDate(Date d)
Format a date into the form required for IMAP search commands. |
void |
appendSearchTerm(SearchTerm term,
String charset)
append an IMAP search sequence from a SearchTerm. |
protected void |
appendSentDate(SentDateTerm term,
String charset)
append IMAP search term information from a SendDateTerm item. |
protected void |
appendSize(SizeTerm term,
String charset)
append IMAP search term information from a SizeTerm item. |
void |
appendString(byte[] value)
Append a value in a byte array to a command buffer. |
void |
appendString(String value)
Append a string value to a command buffer. |
void |
appendString(String value,
String charset)
Append a string value to a command buffer. |
protected void |
appendSubject(SubjectTerm term,
String charset)
append IMAP search term information from a SubjectTerm item. |
static boolean |
checkSearchEncoding(SearchTerm term)
Run the tree of search terms, checking for problems with the terms that may require specifying a CHARSET modifier on a SEARCH command sent to the server. |
static boolean |
checkSearchEncoding(SearchTerm[] terms)
Run an array of search term items to check each one for ASCII encoding problems. |
static boolean |
checkStringEncoding(String s)
Check a string to see if this can be processed using just 7-bit ASCII. |
protected void |
conditionalWhitespace()
Add a whitespace character to the command if the previous token was a type that required a white space character to mark the boundary. |
protected static int |
encode(byte[] buffer,
int count,
StringBuffer result)
Encode a single buffer of characters. |
String |
encode(String original)
Encode a string using the modified UTF-7 encoding. |
void |
endList()
Write out the end of the list. |
String |
getTag()
|
protected String |
recipientType(Message.RecipientType type)
Translate a recipient type into it's string name equivalent. |
void |
startList()
Mark the start of a list value being written to the command. |
void |
writeTo(OutputStream outStream,
IMAPConnection connection)
Write all of the command data to the stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char[] encodingTable
protected boolean needWhiteSpace
protected DataOutputStream out
protected ByteArrayOutputStream sink
protected List segments
protected String tag
protected static int tagCounter
Constructor Detail |
---|
public IMAPCommand()
public IMAPCommand(String command)
command
- The command string used to start this command.Method Detail |
---|
public String getTag()
public void writeTo(OutputStream outStream, IMAPConnection connection) throws IOException, MessagingException
outStream
- connection
-
IOException
MessagingException
public void append(String value)
value
- The value to append.public void appendString(String value)
target
- The target buffer for appending the string.value
- The value to append.public void appendQuotedString(String value)
value
- The value to append.public void appendEncodedString(String value)
target
- The target buffer for appending the string.value
- The value to append.public String encode(String original)
original
- The original string.
protected static int encode(byte[] buffer, int count, StringBuffer result)
buffer
- The buffer to encode.count
- The number of characters in the buffer.result
- The accumulator for appending the result.
public void appendString(String value, String charset) throws MessagingException
target
- The target buffer for appending the string.value
- The value to append.
MessagingException
public void appendString(byte[] value)
target
- The target buffer for appending the string.value
- The value to append.public void appendInteger(int value)
value
- The value to append.public void appendLong(long value)
value
- The value to append.public void appendAtom(String value)
value
- The value to append.public void appendAtom(byte[] value)
value
- The value to append.public void appendLiteral(byte[] value)
value
- The literal data to write.protected void appendLiteralHeader(int size)
size
- The size of the literal value.public void appendLiteral(ByteArrayOutputStream value)
value
- The source of the literal data.public void appendQuotedString(byte[] value)
value
- The bytes of the string to write.public void startList()
public void endList()
protected void conditionalWhitespace()
public void appendBodySection(String section, String partName)
section
- The section numeric identifier.partName
- The name of the body section we want (e.g. "TEST", "HEADERS").public void appendBodySection(String partName)
partName
- The partname we require.public void appendFlags(Flags flags)
flags
- The flag set to append.public void appendDate(Date d)
d
- The source Date.public void appendSearchDate(Date d)
d
- The source Date.public void appendSearchTerm(SearchTerm term, String charset) throws MessagingException
term
- The search term we're processing.charset
- The charset we need to use when generating the sequence.
MessagingException
protected void appendFlag(FlagTerm term, String charset)
term
- The source FlagTermcharset
- target charset for the search information (can be null).out
- The target command buffer.protected void appendAnd(AndTerm term, String charset) throws MessagingException
term
- The source AndTermcharset
- target charset for the search information (can be null).out
- The target command buffer.
MessagingException
protected void appendOr(OrTerm term, String charset) throws MessagingException
term
- The source OrTermcharset
- target charset for the search information (can be null).out
- The target command buffer.
MessagingException
protected void appendNot(NotTerm term, String charset) throws MessagingException
term
- The source NotTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendFrom(FromTerm term, String charset) throws MessagingException
term
- The source FromTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendFrom(FromStringTerm term, String charset) throws MessagingException
term
- The source FromStringTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendRecipient(RecipientTerm term, String charset) throws MessagingException
term
- The source RecipientTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendRecipient(RecipientStringTerm term, String charset) throws MessagingException
term
- The source RecipientStringTermcharset
- target charset for the search information (can be null).
MessagingException
protected String recipientType(Message.RecipientType type) throws MessagingException
type
- The source recipient type
MessagingException
protected void appendHeader(HeaderTerm term, String charset) throws MessagingException
term
- The source HeaderTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendSubject(SubjectTerm term, String charset) throws MessagingException
term
- The source SubjectTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendBody(BodyTerm term, String charset) throws MessagingException
term
- The source BodyTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendSize(SizeTerm term, String charset) throws MessagingException
term
- The source SizeTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendMessageID(MessageIDTerm term, String charset) throws MessagingException
term
- The source MessageIDTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendSentDate(SentDateTerm term, String charset) throws MessagingException
term
- The source SendDateTermcharset
- target charset for the search information (can be null).
MessagingException
protected void appendReceivedDate(ReceivedDateTerm term, String charset) throws MessagingException
term
- The source ReceivedDateTermcharset
- target charset for the search information (can be null).
MessagingException
public static boolean checkSearchEncoding(SearchTerm term)
term
- The term to check.
public static boolean checkSearchEncoding(SearchTerm[] terms)
terms
- The array of terms to check.
public static boolean checkStringEncoding(String s)
s
- The string to check
public void appendFetchProfile(FetchProfile profile) throws MessagingException
profile
- The fetch profile we're using.
MessagingException
public void appendACL(ACL acl)
acl
- The ACL to append.public void appendACL(ACL acl, String modifier)
acl
- The ACL to append.modifier
- The modifer string (can be null).public void appendQuota(Quota quota)
quota
- The quota value to append.public void appendQuotaResource(Quota.Resource resource)
resource
- The resource element we're appending.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |