input
stringlengths
10
828
output
stringlengths
5
107
private void parse buffered reader buf reader throws ioexception string line null prev null while line buf reader read line null if prev null prev line else prev line int end prev length if prev length 0 prev char at end 1 prev prev substring 0 end 1 continue this parse entry prev prev null if prev null this parse entry prev
parse a stream of mime
private void skip white space while current position max position character is whitespace str char at current position current position
skips white space
public void flush do nothing
override flush method in filter output stream
public void ensure at bol throws ioexception if at bol super writeln
ensure were at the beginning of a line
public boolean has more tokens if stack size 0 return true skip white space return current position max position
tests if there are more tokens available from this tokenizers string
public void ignore when parsing source ignore when parsing begin end
causes the this segment to be ignored when parsing
public boolean auth server string server response throws ioexception hashtable map tokenize server response digest md5 computation server response order critical md5 update asciiutility get bytes uri md5 update asciiutility get bytes client response to hex md5 digest string text to hex md5 digest if text equals string map get rspauth if debugout null debugout println debug digest md5 expected rspauth text return false server not authenticated by client return true
allow the client to authenticate the server based on its
public internet address get address return addr
return the address that failed
public string get command return cmd
return the command that failed
public int get return code return rc
return the return code from the smtp server that indicates the
public void set envelope from string from envelope from from
set the from address to appear in the smtp envelope
public list find all tags if all tags null full sequential parse return all tags
returns a list of all
public string get envelope from return envelope from
return the envelope from address
public int compare to final object o if this o return 0 final segment segment segment o if begin segment begin return 1 if begin segment begin return 1 if end segment end return 1 if end segment end return 1 return 0
compares this code segment code object to another object
public void set notify options int options if options 1 options 8 throw new illegal argument exception bad return option notify options options
set notification options to be used if the server supports
public int get notify options return notify options
get notification options
public void set return option int option if option 0 option return hdrs throw new illegal argument exception bad return option return option option
set return option to be used if server supports
public int get return option return return option
return return option
public void set allow8bit mime boolean allow allow8bit mime allow
if set to true and the server supports the 8 bitmime extension text
public boolean get allow8bit mime return allow8bit mime
is use of the 8 bitmime extension is allowed
public string get debug info final string buffer sb new string buffer 50 sb append source get row column vector begin append to sb sb append source get row column vector end append to sb sb append return sb to string
returns a string representation of this object useful for debugging purposes
public void set send partial boolean partial send partial partial
if set to true and this message has some valid and some invalid
public string get submitter return submitter
gets the submitter to be used for the rfc 2554 auth value
public list find all start tags if all start tags null final list all tags find all tags all start tags new array list all tags size for final iterator i all tags iterator i has next final object next i next if next instanceof start tag all start tags add next return all start tags
returns a list of all
public void set submitter string submitter this submitter submitter
sets the submitter to be used for the rfc 2554 auth value
public string get mail extension return extension
gets the extension string to use with the mail command
public string extract text return new text extractor this to string
extracts the textual content from the html markup of this segment
public void set mail extension string extension this extension extension
set the extension string to use with the mail command
public byte array read response throws ioexception return read response null
read a response from the input stream
public string extract text final boolean include attributes return new text extractor this set include attributes include attributes to string
extracts the textual content from the html markup of this segment
public void skip token while index size buffer index index
skip to the next space for use in error recovery while parsing
public list find all elements if all elements null final list all start tags find all start tags if all start tags is empty return collections empty list all elements new array list all start tags size for final iterator i all start tags iterator i has next final start tag start tag start tag i next all elements add start tag get element return all elements
returns a list of all
public byte read byte if index size return buffer index else return 0 xxx how else to signal error
return the next byte from this statement
public string read atom return read atom 0
extract an atom starting at the current position
public string read string char delim skip spaces if index size already at end of response return null int start index while index size buffer index delim index return asciiutility to string buffer start index
read a string as an arbitrary sequence of characters
public int read number skip leading spaces skip spaces int start index while index size character is digit char buffer index index if index start try return asciiutility parse int buffer start index catch number format exception nex return 1
extract an integer starting at the current position
public long read long skip leading spaces skip spaces int start index while index size character is digit char buffer index index if index start try return asciiutility parse long buffer start index catch number format exception nex return 1
extract a long number starting at the current position
public string read string return string parse string false true
extract a nstring starting at the current position
public void append argument arg items ensure capacity items size arg items size for int i 0 i arg items size i items add element arg items element at i
append the given argument to this argument
public byte array input stream read bytes byte array ba read byte array if ba null return ba to byte array input stream else return null
extract a nstring starting at the current position
public void write string string s items add element new astring asciiutility get bytes s
write out given string as an astring depending on the type
public byte array read byte array special case return the data after the continuation uninterpreted it s usually a challenge for an authenticate command if is continuation skip spaces return new byte array buffer index size index return byte array parse string false false
extract a nstring starting at the current position
public void write bytes byte b items add element b
write out given byte as a literal
public void write bytes byte array output stream b items add element b
write out given byte array output stream as a literal
public string read atom string return string parse string true true
extract an astring starting at the current position
public void write bytes literal b items add element b
write out given data as a literal
public void write atom string s items add element new atom s
write out given string as an atom
public void write number int i items add element new integer i
write out number
private boolean is8 bit input stream is int b int linelen 0 boolean need8bit false try while b is read 0 b 0xff if b r b n linelen 0 else if b 0 return false else linelen if linelen 998 1000 crlf return false if b 0x7f need8bit true catch ioexception ex return false if debug need8bit out println debug smtp found an 8bit part return need8bit
check whether the data in the given input stream follows the
public void write number long i items add element new long i
write out number
public void write argument argument c items add element c
write out as parenthesised list
protected response input stream get input stream return input
return the protocols input stream
protected output stream get output stream return output
return the protocols output stream
protected byte array get response buffer return null
return a buffer to be used to read a response
public string get rest skip spaces return asciiutility to string buffer index size
return the rest of the response as a string usually used to
public void handle result response response throws protocol exception if response is ok return else if response is no throw new command failed exception response else if response is bad throw new bad command exception response else if response is bye disconnect throw new connection exception this response
convenience routine to handle ok no bad and bye responses
public void reset index pindex
reset pointer to beginning of response
public byte array input stream to byte array input stream return new byte array input stream bytes start count
returns a byte array input stream
public void grow int incr byte nbuf new byte bytes length incr system arraycopy bytes 0 nbuf 0 bytes length bytes nbuf
grow the byte array by incr bytes
public object get content data source ds throws ioexception try return new mime multipart ds catch messaging exception e ioexception ioex new ioexception exception while constructing mime multipart ioex init cause e throw ioex
return the content
public int available throws ioexception this is bogus we don t really know how much bytes are available after decoding return in available
returns the number of bytes that can be read from this input
public void write byte b int off int len throws ioexception for int i 0 i len i write b off i
encodes code len code bytes from the specified
public string get name throws ioexception read prefix return name
get the name field from the prefix
public int get mode throws ioexception read prefix return mode
get the mode field from the prefix
public void write int c throws ioexception c c 0xff turn off the msb if c output false else if c 040 c 0177 specials index of c 0 encoding required output c true else no encoding required output c false
encodes the specified code byte code to this output stream
private void read prefix throws ioexception if got prefix got the prefix return string s for read till we get the prefix begin mode filename s lin read line note read line consumes crlf pairs too if s null throw new ioexception uudecoder error no begin if s region matches true 0 begin 0 5 try mode integer parse int s substring 6 9 catch number format exception ex throw new ioexception uudecoder error ex to string name s substring 10 got prefix true return
uuencoded streams start off with the line
public void set name mode string name int mode this name name this mode mode
set up the buffer name and permission mode
private void encode throws ioexception int osize encoded size bufsize out write encode buffer 0 bufsize outbuf 0 osize increment count count osize if writing out this encoded unit caused overflow start a new line if count bytes per line if no crlf out write newline count 0
encode the data stored in code buffer code
public void set trace boolean trace this trace trace
set trace mode
public int read throws ioexception int b in read if trace b 1 if quote write byte b else trace out write b return b
reads the next byte of data from this input stream
public int read byte b int off int len throws ioexception int count in read b off len if trace count 1 if quote for int i 0 i count i write byte b off i else trace out write b off count return count
reads up to code len code bytes of data from this input stream
private void write prefix throws ioexception if wrote prefix print stream ps new print stream out ps println begin mode name ps flush wrote prefix true
write out the prefix begin mode name
private void write suffix throws ioexception print stream ps new print stream out ps println nend ps flush
write a single line containing space and the suffix line
public void write int b throws ioexception if trace if quote write byte b else trace out write b out write b
writes the specified code byte code to this output stream
public void write byte b int off int len throws ioexception if trace if quote for int i 0 i len i write byte b off i else trace out write b off len out write b off len
writes code b
public int read throws ioexception if index bufsize bufsize decode buffer 0 buffer length if bufsize 0 buffer is empty return 1 index 0 reset index into buffer return buffer index 0xff zero off the msb
read the next decoded byte from this input stream
public int read throws ioexception int c in read if c return as return else if c qp encoded atom get the next two bytes ba 0 byte in read ba 1 byte in read and decode them try return asciiutility parse int ba 0 2 16 catch number format exception nex throw new ioexception error in qp stream nex get message else return c
read the next decoded byte from this input stream
public boolean mark supported return false maybe later
tests if this input stream supports marks
public int available throws ioexception this is only an estimate since in available might include crlfs too return in available 3 4 bufsize index
returns the number of bytes that can be read from this input
protected output stream data throws messaging exception assert thread holds lock this issue send command data 354 data stream new smtpoutput stream server output return data stream
send the code data code command to the smtp host and return
private int get byte throws ioexception int c do if input pos input len try input len in read input buffer catch eofexception ex return 1 if input len 0 return 1 input pos 0 get the next byte in the buffer c input buffer input pos 0xff is it a padding byte if c return 2 no convert it c pem convert array c loop until we get a legitimate byte while c 1 return c
read the next valid byte from the input stream
private string recent chars reach into the input buffer and extract up to 10 recent characters to help in debugging string errstr int nc input pos 10 10 input pos if nc 0 errstr the nc most recent characters were for int k input pos nc k input pos k char c char input buffer k 0xff switch c case r errstr r break case n errstr n break case t errstr t break default if c c 0177 errstr c else errstr int c errstr return errstr
return the most recent characters for use in an error message
protected void finish data throws ioexception messaging exception assert thread holds lock this data stream ensure at bol issue send command 250
terminate the sent data
public int size return end start 1
count the total number of elements in a message set
protected void set capabilities response r byte b while b r read byte 0 b byte if b 0 return string s s r read atom if s equals ignore case capability return capabilities new hash map 10 authmechs new array list 5 parse capabilities r
if the response contains a capability response code extract
public long size return end start 1
count the total number of elements in a uidset
protected void start tls throws messaging exception issue command starttls 220 it worked now switch the socket into tls mode try server socket socket fetcher start tls server socket session get properties mail name init streams catch ioexception ioex close connection throw new messaging exception could not convert socket to tls ioex
issue the code starttls code command and switch the socket to
public void set rights rights rights this rights rights
set the rights associated with this acl entry
public rights get rights return rights
get the rights associated with this acl entry
public object clone throws clone not supported exception acl acl acl super clone acl rights rights this rights clone return acl
clone this acl entry
protected void process greeting response r throws protocol exception super process greeting r check if it s bad if r is ok check if it s ok set capabilities r return only other choice is preauth imapresponse ir imapresponse r if ir key equals preauth authenticated true set capabilities r else throw new connection exception this r
check the greeting when first connecting look for preauth response
public void add right right this rights int right right true
add the specified right to this rights object
public void add rights rights for int i 0 i rights rights length i if rights rights i this rights i true
add all the rights in the given rights object to this
public void remove right right this rights int right right false
remove the specified right from this rights object
public void remove rights rights for int i 0 i rights rights length i if rights rights i this rights i false
remove all rights in the given rights object from this
public boolean contains right right return this rights int right right
check whether the specified right is present in this rights object
public boolean contains rights rights for int i 0 i rights rights length i if rights rights i this rights i return false if we ve made it till here return true return true
check whether all the rights in the specified rights object are
public boolean is rev1 return rev1
returns code true code if this is a imap4rev1 server
public boolean equals object obj if obj instanceof rights return false rights rights rights obj for int i 0 i rights rights length i if rights rights i this rights i return false return true
check whether the two rights objects are equal
public int hash code int hash 0 for int i 0 i this rights length i if this rights i hash return hash
compute a hash code for this rights object