ccs.utils
Class LineOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by ccs.utils.LineOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class LineOutputStream
extends java.io.FilterOutputStream


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
LineOutputStream(java.io.OutputStream os)
           
 
Method Summary
 boolean isLineStart()
          Whether the stream is at start-of-line.
 void println(java.lang.String s)
          Prints a string to the stream, followed by a newline.
 void write(byte[] b, int off, int len)
          Write arbitrary bytes to the stream.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineOutputStream

public LineOutputStream(java.io.OutputStream os)
Method Detail

println

public void println(java.lang.String s)
             throws java.io.IOException
Prints a string to the stream, followed by a newline. The string is always transcoded as US-ASCII, and the line terminator is always CRLF. This is complies with the requirements of certain common protocols, especially SMTP.

Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Write arbitrary bytes to the stream. These usually represent US-ASCII.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

isLineStart

public boolean isLineStart()
Whether the stream is at start-of-line. This is the case whenever the most recent bytes to pass through were CR/LF.