org.subethamail.smtp.io
Class CRLFTerminatedReader
java.lang.Object
java.io.Reader
org.subethamail.smtp.io.CRLFTerminatedReader
- All Implemented Interfaces:
- Closeable, Readable
public class CRLFTerminatedReader
- extends Reader
A Reader for use with SMTP or other protocols in which lines
must end with CRLF. Extends Reader and overrides its
readLine() method. The Reader readLine() method cannot
serve for SMTP because it ends lines with either CR or LF alone.
JSS: The readline() method of this class has been 'enchanced' from
the Apache JAMES version to throw an IOException if the line is
greater than or equal to MAX_LINE_LENGTH (998) which is defined
in RFC 2822.
|
Method Summary |
void |
close()
|
int |
read()
|
int |
read(char[] cbuf,
int off,
int len)
|
String |
readLine()
Read a line of text which is terminated by CRLF. |
boolean |
ready()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CRLFTerminatedReader
public CRLFTerminatedReader(InputStream in)
CRLFTerminatedReader
public CRLFTerminatedReader(InputStream in,
String enc)
throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
readLine
public String readLine()
throws IOException
- Read a line of text which is terminated by CRLF. The concluding
CRLF characters are not returned with the String, but if either CR
or LF appears in the text in any other sequence it is returned
in the String like any other character. Some characters at the
end of the stream may be lost if they are in a "line" not
terminated by CRLF.
- Returns:
- either a String containing the contents of a
line which must end with CRLF, or null if the end of the
stream has been reached, possibly discarding some characters
in a line not terminated with CRLF.
- Throws:
IOException - if an I/O error occurs.
read
public int read()
throws IOException
- Overrides:
read in class Reader
- Throws:
IOException
ready
public boolean ready()
throws IOException
- Overrides:
ready in class Reader
- Throws:
IOException
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Specified by:
read in class Reader
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Specified by:
close in class Reader
- Throws:
IOException
Copyright © 2006-2012. All Rights Reserved.