input
stringlengths
10
828
output
stringlengths
5
107
public boolean is group quick and dirty check return address null address ends with address index of 0
indicates whether this address is an rfc 822 group address
public void set content id string cid throws messaging exception if cid null remove header content id else set header content id cid
set the content id header field of this body part
public void set number format number format new number format throw new runtime exception method set number format shouldn t be called
dont allow setting the number format
public token next throws parse exception token tk current pos next pos setup current pos tk get next next pos peek pos current pos update current pos and peek pos return tk
parses the next token from this string
public token peek throws parse exception token tk current pos peek pos setup current pos tk get next peek pos current pos update peek pos return tk
peek at the next token without actually removing the token
public void skip until number throws parse exception try while true switch orig index case 0 case 1 case 2 case 3 case 4 case 5 case 6 case 7 case 8 case 9 return default index break catch array index out of bounds exception e throw new parse exception no number found index
skips chars until it finds a number 0 9
public string get content md5 throws messaging exception return get header content md5 null
return the value of the content md5 header field
public string get remainder return string substring next pos
return the rest of the header
public address get sender throws messaging exception address a get address header sender if a null a length 0 return null return a 0 there can be only one
returns the value of the rfc 822 sender header field
public void skip white space int len orig length while index len switch orig index case space case t tab case r cr case n lf index break default return
skips any number of tabs spaces cr and lf folding whitespace
public input stream get input stream throws ioexception input stream is try if part instanceof mime body part is mime body part part get content stream else if part instanceof mime message is mime message part get content stream else throw new messaging exception unknown part string encoding restrict encoding part get encoding part if encoding null return mime utility decode is encoding else return is catch messaging exception mex throw new ioexception mex get message
returns an input stream from this mime part
public output stream get output stream throws ioexception throw new unknown service exception
data source method to return an output stream
public string get content type try return part get content type catch messaging exception mex would like to be able to reflect the exception to the application but since we can t do that we return a generic unknown value here and hope for another exception later return application octet stream
returns the content type of this data source
public string get name try if part instanceof mime body part return mime body part part get file name catch messaging exception mex ignore it return
data source method to return a name
public void set content md5 string md5 throws messaging exception set header content md5 md5
set the content md5 header field of this body part
public int peek char throws parse exception if index orig length return orig index else throw new parse exception no more characters index
used to look at the next character without parsing that
public string get value int i line index of if i 0 return line skip whitespace after int j for j i 1 j line length j char c line char at j if c c t c r c n break return line substring j
return the value part of the header line
public void set sender address address throws messaging exception if address null remove header sender else set header sender address to string
set the rfc 822 sender header field
public void skip char char c throws parse exception if index orig length if orig index c index else throw new parse exception wrong char index else throw new parse exception no more characters index
skips the given character
public boolean skip if char char c throws parse exception if index orig length if orig index c index return true else return false else throw new parse exception no more characters index
will only skip the current char if it matches the given
public string get header string name string delimiter string s get header name if s null return null if s length 1 delimiter null return s 0 string buffer r new string buffer s 0 for int i 1 i s length i r append delimiter r append s i return r to string
get all the headers for this header name returned as a single
public string get description throws messaging exception return get description this
returns the content description header field of this body part
public void set header string name string value boolean found false for int i 0 i headers size i internet header h internet header headers get i if name equals ignore case h get name if found int j if h line null j h line index of 0 h line h line substring 0 j 1 value preserves capitalization spacing else h line name value found true else headers remove i i have to look at i again if found add header name value
change the first header line that matches name
public void add header string name string value int pos headers size boolean add reverse name equals ignore case received name equals ignore case return path if add reverse pos 0 for int i headers size 1 i 0 i internet header h internet header headers get i if name equals ignore case h get name if add reverse pos i else headers add i 1 new internet header name value return marker for default place to add new headers if h get name equals pos i headers add pos new internet header name value
add a header with the specified name and value to the header list
public void set description string description throws messaging exception set description description null
set the content description header field for this body part
public void remove header string name for int i 0 i headers size i internet header h internet header headers get i if name equals ignore case h get name h line null headers remove i i have to look at i again
remove all header entries that match the given name
public int parse time zone throws parse exception if index orig length throw new parse exception no more characters index char test orig index if test test return parse numeric time zone else return parse alpha time zone
will parse the timezone either numerical version e
public enumeration get all headers return new match enum headers null false false
return all the headers as an enumeration of
public enumeration get matching headers string names return new match enum headers names true false
return all matching
public int parse numeric time zone throws parse exception we switch the sign if it is a since the time in the string we are parsing is off from gmt by that amount and we want to get the time back into gmt so we substract it boolean switch sign false char first orig index if first switch sign true else if first throw new parse exception bad numeric time zone index int tz parse number int offset tz 100 60 tz 100 if switch sign return offset else return offset
will parse the numerical time zone version e
public enumeration get non matching headers string names return new match enum headers names false false
return all non matching
public void add header line string line try char c line char at 0 if c c t internet header h internet header headers get headers size 1 h line r n line else headers add new internet header line catch string index out of bounds exception e line is empty ignore it return catch no such element exception e xxx vector is empty
add an rfc822 header line to the header store
public string get file name throws messaging exception return get file name this
get the filename associated with this body part
public enumeration get all header lines return get non matching header lines null
return all the header lines as an enumeration of strings
public void connect throws messaging exception connect null null null
a generic connect method that takes no parameters
public enumeration get matching header lines string names return new match enum headers names true true
return all matching header lines as an enumeration of strings
public enumeration get non matching header lines string names return new match enum headers names false true
return all non matching header lines
public void set file name string filename throws messaging exception set file name this filename
set the filename associated with this body part if possible
public void connect string user string password throws messaging exception connect null user password
connect to the current host using the specified username
public multipart get parent return parent
return the containing code multipart code object
protected object read resolve throws object stream exception if type equals to return to else if type equals cc return cc else if type equals bcc return bcc else throw new invalid object exception attempt to resolve unknown recipient type type
when deserializing a recipient type we need to make sure to
public string to string urlname url get urlname if url null return url to string else return super to string
return code get urlname
protected void queue event mail event event vector vector synchronize creation of the event queue synchronized q lock if q null q new event queue copy the vector in order to freeze the state of the set of event listeners the event should be delivered to prior to delivery this ensures that any changes made to the vector from a target listener s method during the delivery of this event will not take effect until after the event is delivered vector v vector vector clone q enqueue event v
add the event and vector of listeners to the queue to be delivered
protected input stream get content stream throws messaging exception if content stream null return shared input stream content stream new stream 0 1 if content null return new byte array input stream content throw new messaging exception no content
produce the raw bytes of the content
public void set reply to address addresses throws messaging exception throw new method not supported exception set reply to not supported
set the addresses to which replies should be directed
public void set reply to address addresses throws messaging exception set address header reply to addresses
set the rfc 822 reply to header field
protected void finalize throws throwable super finalize terminate queue
stop the event dispatcher thread so the queue can be garbage collected
public input stream get raw input stream throws messaging exception return get content stream
return an input stream to the raw data with any content transfer encoding
public boolean is set flags flag flag throws messaging exception return get flags contains flag
check whether the flag specified in the code flag code
public int get message type return type
return the type of this event
public void dispatch object listener store listener listener notification this
invokes the appropriate store listener method
public folder get new folder return new folder
if this event indicates that a folder is renamed i
public void dispatch object listener if type created folder listener listener folder created this else if type deleted folder listener listener folder deleted this else if type renamed folder listener listener folder renamed this
invokes the appropriate folder listener method
public message get message return msg
get the message object associated with this transport event
public void dispatch object listener if type message delivered transport listener listener message delivered this else if type message not delivered transport listener listener message not delivered this else message partially delivered transport listener listener message partially delivered this
invokes the appropriate transport listener method
public data handler get data handler throws messaging exception if dh null dh new data handler new mime part data source this return dh
return a data handler for this body parts content
public int get message number return msgnum
get the message number for this message
public void dispatch object listener if type opened connection listener listener opened this else if type disconnected connection listener listener disconnected this else if type closed connection listener listener closed this
invokes the appropriate connection listener method
protected void set message number int msgnum this msgnum msgnum
set the message number for this message
public boolean is removed return removed
indicates whether this event is the result of an explicit
public void dispatch object listener if type added message count listener listener messages added this else removed message count listener listener messages removed this
invokes the appropriate message count listener method
public int get message change type return type
return the type of this event
public void dispatch object listener message changed listener listener message changed this
invokes the appropriate message changed listener method
public object get content throws ioexception messaging exception if cached content null return cached content object c try c get data handler get content catch folder closed ioexception fex throw new folder closed exception fex get folder fex get message catch message removed ioexception mex throw new message removed exception mex get message if cache multipart c instanceof multipart c instanceof message content null content stream null cached content c return c
return the content as a java object
public void add item item if specials null specials new vector specials add element item
add the given special item as one of the attributes to
public void add string header name if headers null headers new vector headers add element header name
add the specified header field to the list of attributes
public boolean contains item item return specials null specials contains item
returns true if the fetch profile contains given special item
public boolean contains string header name return headers null headers contains header name
returns true if the fetch profile contains given header name
public boolean is expunged return expunged
checks whether this message is expunged
public void add flag flag system flags flag bit
add the specified system flag to this flags object
protected void set expunged boolean expunged this expunged expunged
sets the expunged flag for this message
public void add string flag if user flags null user flags new hashtable 1 user flags put flag to lower case locale english flag
add the specified user flag to this flags object
public void add flags f system flags f system flags add system flags if f user flags null add user defined flags if user flags null user flags new hashtable 1 enumeration e f user flags keys while e has more elements string s string e next element user flags put s f user flags get s
add all the flags in the given flags object to this
public void remove flag flag system flags flag bit
remove the specified system flag from this flags object
public boolean match search term term throws messaging exception return term match this
apply the specified search criterion to this message
public void remove string flag if user flags null user flags remove flag to lower case locale english
remove the specified user flag from this flags object
public string get subject throws messaging exception string rawvalue get header subject null if rawvalue null return null try return mime utility decode text mime utility unfold rawvalue catch unsupported encoding exception ex return rawvalue
returns the value of the subject header field
public void remove flags f system flags f system flags remove system flags if f user flags null if user flags null return enumeration e f user flags keys while e has more elements user flags remove e next element
remove all flags in the given flags object from this
protected void notify store listeners int type string message if store listeners null return store event e new store event this type message queue event e store listeners
notify all store listeners
protected void notify folder listeners int type folder folder if folder listeners null return folder event e new folder event this folder type queue event e folder listeners
notify all folder listeners
public boolean contains flag flag return system flags flag bit 0
check whether the specified system flag is present in this flags object
protected void notify folder renamed listeners folder old f folder new f if folder listeners null return folder event e new folder event this old f new f folder event renamed queue event e folder listeners
notify all folder listeners about the renaming of a folder
public boolean contains string flag if user flags null return false else return user flags contains key flag to lower case locale english
check whether the specified user flag is present in this flags object
public input stream get input stream throws ioexception if data null throw new ioexception no data if len 0 len data length return new shared byte array input stream data 0 len
return an input stream for the data
public output stream get output stream throws ioexception throw new ioexception cannot do this
return an output stream for the data
public boolean contains flags f check system flags if f system flags system flags f system flags return false check user flags if f user flags null if user flags null return false enumeration e f user flags keys while e has more elements if user flags contains key e next element return false if we ve made it till here return true return true
check whether all the flags in the specified flags object are
public string get content type return type
get the mime content type of the data
public void set text string text throws messaging exception set text text null
convenience method that sets the given string as this
public boolean equals object obj if obj instanceof flags return false flags f flags obj check system flags if f system flags this system flags return false check user flags if f user flags null this user flags null return true if f user flags null this user flags null f user flags size this user flags size enumeration e f user flags keys while e has more elements if this user flags contains key e next element return false return true return false
check whether the two flags objects are equal
public void set subject string subject throws messaging exception set subject subject null
set the subject header field
public long get position return pos start
return the current position in the input stream as an
public input stream new stream long start long end if start 0 throw new illegal argument exception start 0 if end 1 end count this start return new shared byte array input stream buf this start int start int end start
return a new input stream representing a subset of the data
public int hash code int hash system flags if user flags null enumeration e user flags keys while e has more elements hash string e next element hash code return hash
compute a hash code for this flags object
public object clone flags f null try f flags super clone catch clone not supported exception cex ignore can t happen if this user flags null f null f user flags hashtable this user flags clone return f
returns a clone of this flags object
public boolean match message msg string subj try subj msg get subject catch exception e return false if subj null return false return super match subj
the match method
public boolean match message msg int size try size msg get size catch exception e return false if size 1 return false return super match size
the match method
protected boolean match address a if a instanceof internet address internet address ia internet address a we dont use to string to get a s string representation because internet address to string returns a rfc 2047 encoded string which isn t what we need here return super match ia to unicode string else return super match a to string
check whether the address pattern specified in the constructor is
public int hash code return comparison
compute a hash code for this object
public flags get flags return flags flags clone
return the flags to test
public boolean get test set return set
return true if testing whether the flags are set