FileDocCategorySizeDatePackage
LineOutputStream.javaAPI DocGlassfish v2 API3043Mon May 14 15:28:46 BST 2007com.sun.mail.util

LineOutputStream

public class LineOutputStream extends FilterOutputStream
This class is to support writing out Strings as a sequence of bytes terminated by a CRLF sequence. The String must contain only US-ASCII characters.

The expected use is to write out RFC822 style headers to an output stream.

author
John Mani

Fields Summary
private static byte[]
newline
Constructors Summary
public LineOutputStream(OutputStream out)

	newline = new byte[2];
	newline[0] = (byte)'\r";
	newline[1] = (byte)'\n";
    
	super(out);
    
Methods Summary
public voidwriteln(java.lang.String s)

	try {
	    byte[] bytes = ASCIIUtility.getBytes(s);
	    out.write(bytes);
	    out.write(newline);
	} catch (Exception ex) {
	    throw new MessagingException("IOException", ex);
	}
    
public voidwriteln()

	try {
	    out.write(newline);
	} catch (Exception ex) {
	    throw new MessagingException("IOException", ex);
	}