input
stringlengths
10
828
output
stringlengths
5
107
public boolean is message return mime type equals message rfc822
return true if the body descriptor belongs to a message
public boolean is multipart return mime type starts with multipart
retrun true if the body descripotro belogns to a multipart
private void populate pushback queue throws ioexception debug verify pushbackq count 0 populate pushback queue called when pushback queue was not empty if pushbackq count 0 return while true int i stream read switch i case 1 stream is done pushbackq clear discard any whitespace preceding eof return case case t pushbackq enqueue byte i break case r case n pushbackq clear discard any whitespace preceding eol pushbackq enqueue byte i return default pushbackq enqueue byte i return
pulls bytes out of the underlying stream and places them in the
public string get boundary return boundary
return the boundary
private byte ascii char to numeric value byte c if c 0 c 9 return byte c 0 else if c a c z return byte 0x a c a else if c a c z return byte 0x a c a else this should never happen since all calls to this method are preceded by a check that c is in 0 9 a za z throw new illegal argument exception char c is not a hexadecimal digit
converts 0 0 a 10 etc
public string get charset return charset
return the charset
public void close throws ioexception s close
closes the underlying stream
public string get transfer encoding return transfer encoding
return the transfer encoding
public rights my rights throws messaging exception return rights do optional command acl not supported new protocol command public object do command imapprotocol p throws protocol exception return p my rights full name
get the rights allowed to the currently authenticated user
private void fill buffer throws ioexception byte data new byte 4 int pos 0 int i while done switch i s read case 1 if pos 0 log warn unexpected eof in mime parser dropping pos sextets return case decode and enqueue data pos done true break default byte s x translation i if s x 0 continue data pos s x if pos data length decode and enqueue data pos return break
retrieve data from the underlying stream decode it
public boolean is base64 encoded return base64 equals transfer encoding
return true if its base64 encoded
private int content length internet headers hdrs int len 1 string cl hdrs get header content length try if cl null cl 0 null len integer parse int cl 0 catch number format exception e return len
extract the value of the content length header if present
public boolean is quoted printable encoded return quoted printable equals transfer encoding
return true if its quoted printable
public boolean add final byte b if size 1 buffer length byte tmp new byte buffer length 1 2 1 int j 0 for int i head i tail tmp j buffer i buffer i 0 j i if i buffer length i 0 buffer tmp head 0 tail j buffer tail b tail if tail buffer length tail 0 return true
adds the given element to this buffer
public byte get if is empty throw new illegal state exception the buffer is already empty return buffer head
returns the next object in the buffer
public byte remove if is empty throw new illegal state exception the buffer is already empty byte element buffer head head if head buffer length head 0 return element
removes the next object from the buffer
public boolean has more parts return more parts
determines if the underlying stream has more parts this stream has
public boolean parent eof return parenteof
determines if the parent stream has reached eof
public void consume throws ioexception while read 1
consumes all unread bytes of this stream
public void parse input stream is throws ioexception root stream new root input stream is parse message root stream
parses a stream of bytes containing a mime message
public boolean is raw return raw
determines if this parser is currently in raw mode
public void set raw boolean raw this raw raw
enables or disables raw mode
public void stop root stream truncate
finishes the parsing and stops reading lines
public void set content handler content handler h this handler h
sets the code content handler code to use when reporting
protected folder create folder mbox store store string name return new mbox folder store name
create an mbox folder object or a subclass thereof
public string get epilogue return epilogue
gets the epilogue
public void set epilogue string epilogue this epilogue epilogue
sets the epilogue
public list get body parts return collections unmodifiable list body parts
gets the list of body parts
public void set body parts list body parts this body parts body parts for iterator it body parts iterator it has next body part it next set parent parent
sets the list of body parts
public void add body part body part body part body parts add body part body part set parent parent
adds a body part to the end of the list of body parts
public string get preamble return preamble
gets the preamble
public void set preamble string preamble this preamble preamble
sets the preamble
private string get boundary entity e get parent content type field c field content type field e get header get field field content type return c field get boundary
return the boundory of the parent entity
static public boolean path string s string pat char delim try return path s 0 s length pat 0 pat length delim catch string index out of bounds exception e return false
pathname pattern match
public unstructured field get subject return unstructured field get header get field field subject
gets the code subject code field
static public boolean dir string s string pat char delim try return dir s 0 s length pat 0 pat length delim catch string index out of bounds exception e return false
directory pattern match
public void raw input stream is throws ioexception throw new unsupported operation exception not supported
todo implement me
private imapprotocol get protocol throws protocol exception assert thread holds lock message cache lock wait if idle return protocol
return the imapprotocol object for this folder
public void add field field field list values list field map get field get name to lower case if values null values new linked list field map put field get name to lower case values values add field fields add field
adds a field to the end of the list of fields
public list get fields return collections unmodifiable list fields
gets the fields of this header
public field get field string name list l list field map get name to lower case if l null l is empty return field l get 0 return null
gets a code field code given a field name
public list get fields string name list l list field map get name to lower case return collections unmodifiable list l
gets all code field code s having the specified field name
public string to string string buffer str new string buffer for iterator it fields iterator it has next str append it next to string str append r n return str to string
return header object as string representation
public void write to output stream out throws ioexception string char string content type field get field field content type get charset buffered writer writer new buffered writer new output stream writer out charset util get charset char string 8192 writer write to string r n writer flush
write the header to the given output stream
public void set field parser final string name final field parser parser parsers put name to lower case parser
sets the parser used for the field named code name code
public entity get parent return parent
gets the parent entity of this entity
public void set parent entity parent this parent parent
sets the parent entity of this entity
public void truncate this truncated true
truncates this code input stream code
public header get header return header
gets the entity header
public void set header header header this header header
sets the entity header
public body get body return body
gets the body of this entity
public parse exception get parse exception return parse exception
gets the exception that was raised during parsing of
public void set body body body this body body body set parent this
sets the body of this entity
public string get mime type content type field child content type field get header get field field content type content type field parent get parent null content type field get parent get header get field field content type null return content type field get mime type child parent
determines the mime type of this code entity code
public string get charset return content type field get charset content type field get header get field field content type
determines the mime character set encoding of this code entity code
public string get parameter string name return parameters null string parameters get name to lower case null
gets the value of a parameter
public string get raw return raw
gets the original raw field string
public string get content transfer encoding content transfer encoding field f content transfer encoding field get header get field field content transfer encoding return content transfer encoding field get encoding f
determines the transfer encoding of this code entity code
public map get parameters return parameters null collections unmodifiable map parameters collections empty map
gets all parameters
public boolean is content type return content type equals ignore case name
determines if this is a code content type code field
public boolean is mime type string type return get mime type equals ignore case type
determines if the mime type of this code entity code matches the
public boolean is subject return subject equals ignore case name
determines if this is a code subject code field
public string get boundary return get parameter param boundary
gets the value of the code boundary code parameter if set
public boolean is from return from equals ignore case name
determines if this is a code from code field
public boolean is to return to equals ignore case name
determines if this is a code to code field
public string get charset return get parameter param charset
gets the value of the code charset code parameter if set
public boolean is mime type string mime type return this mime type equals ignore case mime type
determines if the mime type of this field matches the given one
public object do command protocol command cmd throws messaging exception try return do protocol command cmd catch connection exception cex oops the store or folder died on us throw closed exception cex catch protocol exception pex throw new messaging exception pex get message pex return null
execute a user supplied imap command
public int size return domains size
the number of elements in this list
public string get int index if 0 index size index throw new index out of bounds exception return string domains get index
gets the domain name or domain literal at the
public string to route string string buffer out new string buffer for int i 0 i domains size i out append out append get i if i 1 domains size out append return out to string
returns the list of domains formatted as a route
public domain list get route return route
returns the route list
public string get address string return get address string false
formats the address as a string not including
public string get address string boolean include route return include route route null route to route string local part domain null domain
note that this value may not be usable
public int size return addresses size
the number of elements in this list
public address get int index if 0 index size index throw new index out of bounds exception return address addresses get index
gets an address
public mailbox list flatten in the common case all addresses are mailboxes boolean group detected false for int i 0 i size i if get i instanceof mailbox group detected true break if group detected return new mailbox list addresses true array list results new array list for int i 0 i size i address addr get i addr add mailboxes to results copy on construct this time because subclasses could have held onto a reference to the results return new mailbox list results false
returns a flat list of all mailboxes represented
public void print for int i 0 i size i address addr get i system out println addr to string
dumps a representation of this address list to
public mailbox list get mailboxes return mailbox list
returns the mailboxes in this group
public int size return mailboxes size
the number of elements in this list
public mailbox get int index if 0 index size index throw new index out of bounds exception return mailbox mailboxes get index
gets an address
public void print for int i 0 i size i mailbox mailbox get i system out println mailbox to string
dumps a representation of this mailbox list to
public string get address string boolean include route return name null name super get address string include route
same features or problems as mailbox
public object jjt accept address list parser visitor visitor object data return visitor visit this data
accept the visitor
public object children accept address list parser visitor visitor object data if children null for int i 0 i children length i children i jjt accept visitor data return data
accept the visitor
private void release protocol boolean return to pool if protocol null protocol remove response handler this if return to pool imapstore store release protocol this protocol else imapstore store release protocol this null
release the protocol object
public void close throws ioexception is null
set the underlying input stream to null
private void check if closed throws ioexception if is null throw new ioexception stream is closed
check if the underlying input stream is null
public boolean accept file file string name file get name for int i 0 i this prefixes length i if case sensitivity check starts with name prefixes i return true return false
checks to see if the filename starts with the prefix
public boolean accept file file string name for int i 0 i prefixes length i if case sensitivity check starts with name prefixes i return true return false
checks to see if the filename starts with the prefix
public string to string string buffer buffer new string buffer buffer append super to string buffer append if prefixes null for int i 0 i prefixes length i if i 0 buffer append buffer append prefixes i buffer append return buffer to string
provide a string representaion of this file filter
public boolean accept file file boolean newer file utils is file newer file cutoff return accept older newer newer
checks to see if the last modification of the file matches cutoff
public string to string string condition accept older return super to string condition cutoff
provide a string representaion of this file filter
public boolean accept file dir string name if dir null new file dir name is directory return false for int i 0 i wildcards length i if filename utils wildcard match name wildcards i return true return false
checks to see if the filename matches one of the wildcards
public boolean accept file file if file is directory return false for int i 0 i wildcards length i if filename utils wildcard match file get name wildcards i return true return false
checks to see if the filename matches one of the wildcards
public boolean accept file file if file filter null return file filter accept file else return super accept file
checks the filter
public boolean accept file dir string name if filename filter null return filename filter accept dir name else return super accept dir name
checks the filter
public string to string string delegate file filter null file filter to string filename filter to string return super to string delegate
provide a string representaion of this file filter
public string to string string buffer buffer new string buffer buffer append super to string buffer append if file filters null for int i 0 i file filters size i if i 0 buffer append object filter file filters get i buffer append filter null null filter to string buffer append return buffer to string
provide a string representaion of this file filter
public boolean accept file file return file can read
checks to see if the file can be read