input
stringlengths
10
828
output
stringlengths
5
107
public void set file type map file type map map type map map
set the file type map to use with this file data source
public data source get data source if data source null create one on the fly if obj data source null obj data source new data handler data source this return obj data source return data source
return the data source associated with this instance
public string get name if data source null return data source get name else return null
return the name of the data object
public string get content type if data source null data source case return data source get content type else return object mime type obj type case
return the mime type of this object as retrieved from
private mailcap file load file string name mailcap file mtf null try mtf new mailcap file name catch ioexception e e print stack trace return mtf
load from the named file
public void write to output stream os throws ioexception for the data source case if data source null input stream is null byte data new byte 8 1024 int bytes read is data source get input stream try while bytes read is read data 0 os write data 0 bytes read finally is close is null else for the object case data content handler dch get data content handler dch write to object object mime type os
write the data to an code output stream code
private void append pref cmds to list map cmd hash list cmd list iterator verb enum cmd hash key set iterator while verb enum has next string verb string verb enum next if check for verb cmd list verb list cmd list2 list cmd hash get verb get the list string class name string cmd list2 get 0 cmd list add new command info verb class name
put the commands that are in the hash table into the list
private boolean check for verb list cmd list string verb iterator ee cmd list iterator while ee has next string enum verb string command info ee next get command name if enum verb equals verb return true return false
check the cmd list to see if this command exists return
public output stream get output stream throws ioexception if data source null return data source get output stream else return null
get an output stream for this data handler to allow overwriting
private void append cmds to list map type hash list cmd list iterator verb enum type hash key set iterator while verb enum has next string verb string verb enum next list cmd list2 list type hash get verb iterator cmd enum list cmd list2 iterator while cmd enum has next string cmd string cmd enum next cmd list add new command info verb cmd cmd list add 0 new command info verb cmd
put the commands that are in the hash table into the list
public boolean is data flavor supported data flavor flavor data flavor l flavors get transfer data flavors for int i 0 i l flavors length i if l flavors i equals flavor return true return false
returns whether the specified data flavor is supported
public boolean is empty return parameters is empty
determine whether or not this list is empty
public string get string name return string parameters get name trim to lower case locale english
retrieve the value associated with the given name or null if there
public void set string name string value parameters put name trim to lower case locale english value
set the value to be associated with the given name replacing
public command info get command string cmd name if data source null return get command map get command get base type cmd name data source else return get command map get command get base type cmd name
get the command i cmd name i
public void remove string name parameters remove name trim to lower case locale english
remove any value associated with the given name
public enumeration get names return parameters keys
retrieve an enumeration of all the names in this list
public string to string string buffer buffer new string buffer buffer ensure capacity parameters size 16 heuristic 8 characters per field enumeration keys parameters keys while keys has more elements string key string keys next element buffer append buffer append key buffer append buffer append quote string parameters get key return buffer to string
return a string representation of this object
public static void set default file type map file type map map security manager security system get security manager if security null try if it s ok with the security manager it s ok with me security check set factory catch security exception ex otherwise we also allow it if this code and the factory come from the same class loader e g the jaf classes were loaded with the applet classes if file type map class get class loader map get class get class loader throw ex default map map
sets the default file type map for the system
public object get content throws ioexception if object null return object else return get data content handler get content get data source
return the data in its preferred object form
public class get representation class return representation class
return the representation class
public string get human presentable name return human presentable name
return the human presentable name
public void set human presentable name string human presentable name this human presentable name human presentable name
set the human presentable name
public boolean equals data flavor data flavor return is mime type equal data flavor data flavor get representation class representation class
compares the data flavor passed in with this data flavor calls
public object get bean command info cmdinfo object bean null try make the bean class loader cld null first try the application s class loader cld security support get context class loader if cld null cld this get class get class loader bean cmdinfo get command object this cld catch ioexception e catch class not found exception e return bean
a convenience method that takes a command info object
public boolean is mime type equal string mime type mime type mt null try if mime object null mime object new mime type this mime type mt new mime type mime type catch mime type parse exception e something didn t parse do a crude comparison return this mime type equals ignore case mime type return mime object match mt
is the string representation of the mime type passed in equivalent
public string get primary type return primary type
retrieve the primary type of this object
protected string normalize mime type string mime type return mime type
called for each mime type string to give data flavor subtypes the
public void set primary type string primary throws mime type parse exception check to see if primary is valid if is valid token primary type throw new mime type parse exception primary type is invalid primary type primary to lower case locale english
set the primary type for this object to the given string
public string get command name return verb
return the command verb
public string get command class return class name
return the commands class name
public string get sub type return sub type
retrieve the subtype of this object
public input stream get input stream throws ioexception return data handler get input stream
returns an code input stream code representing this object
public void set sub type string sub throws mime type parse exception check to see if sub is valid if is valid token sub type throw new mime type parse exception sub type is invalid sub type sub to lower case locale english
set the subtype for this object to the given string
public mime type parameter list get parameters return parameters
retrieve this objects parameter list
public string get parameter string name return parameters get name
retrieve the value associated with the given name or null if there
private mime type file load file string name mime type file mtf null try mtf new mime type file name catch ioexception e e print stack trace return mtf
load the named file
public void set parameter string name string value parameters set name value
set the value to be associated with the given name replacing
public string get content type file f return this get content type f get name
return the mime type of the file object
public output stream get output stream throws ioexception return data handler get output stream
returns the code output stream code for this object
public void remove parameter string name parameters remove name
remove any value associated with the given name
public string to string return get base type parameters to string
return the string representation of this object
public string get base type return primary type sub type
return a string representation of this object
public boolean match mime type type return primary type equals type get primary type sub type equals type get sub type equals sub type equals type get sub type
determine if the primary and sub type of this object is
public string get content type return data handler get content type
returns the mime type of the data represented by this object
public boolean match string rawdata throws mime type parse exception return match new mime type rawdata
determine if the primary and sub type of this object is
public void write external object output out throws ioexception out write utf to string out flush
the object implements the write external method to save its contents
protected password authentication get password authentication return null
called when password authentication is needed
private boolean is valid token string s int len s length if len 0 for int i 0 i len i char c s char at i if is token char c return false return true else return false
determine whether or not a given string is a legal token
public string get name return data handler get name what else would it be
returns the name of this object
public string get disposition return disposition
return the disposition value
public string get parameter string name if list null return null return list get name
return the specified parameter value
public parameter list get parameter list return list
return a parameter list object that holds all the available
public void set disposition string disposition this disposition disposition
set the disposition
public void set parameter string name string value if list null list new parameter list list set name value
set the specified parameter
public void set parameter list parameter list list this list list
set a new parameter list
public string to string if disposition null return null if list null return disposition string buffer sb new string buffer disposition append the parameter list use the length of the string buffer the length of the header name formatted as follows content disposition sb append list to string sb length 21 return sb to string
retrieve a rfc2045 style string representation of
public string get encoding throws messaging exception return encoding
returns the content transfer encoding specified when
protected void update headers throws messaging exception super update headers mime body part set encoding this encoding
force the code content transfer encoding code header to use
public boolean remove body part body part part throws messaging exception parse return super remove body part part
remove the specified part from the multipart message
public void remove body part int index throws messaging exception parse super remove body part index
remove the part at specified location starting from 0
public data content handler get dch return dch
return the data content handler for this object
private void skip fully input stream in long offset throws ioexception while offset 0 long cur in skip offset if cur 0 throw new eofexception can t skip offset cur
skip the specified number of bytes repeatedly calling
public string get string name string value object v list get name trim to lower case locale english if v instanceof multi value value multi value v value else if v instanceof value value value v value else value string v return value
returns the value of the specified parameter
public string get type return news
return the type of this address
public void set newsgroup string newsgroup this newsgroup newsgroup
set the newsgroup
public string get newsgroup return newsgroup
get the newsgroup
public void set string name string value string charset if encode parameters value ev encode value value charset was it actually encoded if ev null list put name trim to lower case locale english ev else set name value else set name value
set a parameter
public string to string return newsgroup
convert this address into a rfc 1036 address
public boolean equals object a if a instanceof news address return false news address s news address a return newsgroup equals s newsgroup host null s host null host null s host null host equals ignore case s host
the equality operator
public int hash code int hash 0 if newsgroup null hash newsgroup hash code if host null hash host to lower case locale english hash code return hash
compute a hash code for the address
public void remove string name list remove name trim to lower case locale english
removes the specified parameter from this parameter list
public object clone internet address a null try a internet address super clone catch clone not supported exception e won t happen return a
return a copy of this internet address object
public enumeration get names return new param enum list key set iterator
return an enumeration of the names of all parameters in this
public void set primary type string primary type this primary type primary type
set the primary type
public string get type return rfc822
return the type of this address
public void set sub type string sub type this sub type sub type
set the sub type
public string to string if primary type null sub type null need both return null string buffer sb new string buffer sb append primary type append append sub type if list null append the parameter list use the length of the string buffer the length of the header name formatted as follows content type sb append list to string sb length 14 return sb to string
retrieve a rfc2045 style string representation of
public int get size throws messaging exception if content null return content length if content stream null try int size content stream available only believe the size if it s greate than zero since zero is the default returned by the input stream class itself if size 0 return size catch ioexception ex ignore it return 1
return the size of the content of this body part in bytes
public int get line count throws messaging exception return 1
return the number of lines for the content of this part
public string get personal if personal null return personal if encoded personal null try personal mime utility decode text encoded personal return personal catch exception ex 1 parse exception either its an unencoded string or it can t be parsed 2 unsupported encoding exception can t decode it return encoded personal no personal or encoded personal return null return null
get the personal name
public string get content type throws messaging exception string s get header content type null if s null s text plain return s
returns the value of the rfc 822 content type header field
private void init strict if session null string s session get property mail mime address strict strict s null s equals ignore case false
set the strict flag based on property
public string to string if encoded personal null personal null try encoded personal mime utility encode word personal catch unsupported encoding exception ex if encoded personal null return quote phrase encoded personal address else if is group is simple return address else return address
convert this address into a rfc 822 rfc 2047 encoded address
public boolean is mime type string mime type throws messaging exception return is mime type this mime type
is this part of the specified mime type this method
public string to unicode string string p get personal if p null return quote phrase p address else if is group is simple return address else return address
returns a properly formatted address rfc 822 syntax of
protected void parse input stream is throws messaging exception if is instanceof byte array input stream is instanceof buffered input stream is instanceof shared input stream is new buffered input stream is headers create internet headers is if is instanceof shared input stream shared input stream sis shared input stream is content stream sis new stream sis get position 1 else try content asciiutility get bytes is catch ioexception ioex throw new messaging exception ioexception ioex modified false
parse the input stream setting the code headers code and
public string get disposition throws messaging exception return get disposition this
returns the value of the content disposition header field
public boolean equals object a if a instanceof internet address return false string s internet address a get address if s address return true if address null address equals ignore case s return true return false
the equality operator
public void set from address address throws messaging exception if address null remove header from else set header from address to string
set the rfc 822 from header field
public int hash code if address null return 0 else return address to lower case locale english hash code
compute a hash code for the address
public void set disposition string disposition throws messaging exception set disposition this disposition
set the content disposition header field of this body part
public void validate throws address exception check address get address true true
validate that this address conforms to the syntax rules of
public string get encoding throws messaging exception return get encoding this
returns the content transfer encoding from the
public void set from throws messaging exception internet address me internet address get local address session if me null set from me else throw new messaging exception no from address
set the rfc 822 from header field using the value of the
public date parse string text parse position pos return parse date text to char array pos is lenient
parses the given date in the format specified by
private boolean is simple return address null index of any address specials no dot no at 0
is this a simple address simple addresses dont contain quotes
public string get content id throws messaging exception return get header content id null
returns the value of the content id header field
public void set calendar calendar new calendar throw new runtime exception method set calendar shouldn t be called
dont allow setting the calendar
public void add from address addresses throws messaging exception add address header from addresses
add the specified addresses to the existing from field