Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.http
Class NullableOutputStream  view NullableOutputStream download NullableOutputStream.java

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byorg.mortbay.http.NullableOutputStream
All Implemented Interfaces:
HttpMessage.HeaderWriter

public class NullableOutputStream
extends java.io.FilterOutputStream
implements HttpMessage.HeaderWriter

Buffered Output Stream. Uses ByteBufferOutputStream to allow pre and post writes.

Version:
$Revision: 1.4 $

Field Summary
private  boolean _closed
           
private  int _headerReserve
           
private  org.mortbay.util.ByteArrayISO8859Writer _httpMessageWriter
           
private  boolean _nulled
           
private static org.apache.commons.logging.Log log
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
NullableOutputStream(java.io.OutputStream outputStream, int headerReserve)
           
 
Method Summary
 void close()
          Close the stream.
 void destroy()
           
 void flush()
          This method attempt to flush all buffered output to be written to the underlying output sink.
 boolean isNullOutput()
          is the output Nulled?
 void nullOutput()
          Null the output.
 void resetStream()
           
 void write(byte[] b)
          This method writes all the bytes in the specified array to the underlying OutputStream.
 void write(byte[] b, int off, int len)
          This method calls the write(int) method len times for all bytes from the array buf starting at index offset.
 void write(int b)
          This method writes a single byte of output to the underlying OutputStream.
 void writeHeader(HttpMessage httpMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

_httpMessageWriter

private org.mortbay.util.ByteArrayISO8859Writer _httpMessageWriter

_nulled

private boolean _nulled

_closed

private boolean _closed

_headerReserve

private int _headerReserve
Constructor Detail

NullableOutputStream

public NullableOutputStream(java.io.OutputStream outputStream,
                            int headerReserve)
Method Detail

nullOutput

public void nullOutput()
                throws java.io.IOException
Null the output. All output written is discarded until the stream is reset. Used for HEAD requests.


isNullOutput

public boolean isNullOutput()
                     throws java.io.IOException
is the output Nulled?


writeHeader

public void writeHeader(HttpMessage httpMessage)
                 throws java.io.IOException
Specified by:
writeHeader in interface HttpMessage.HeaderWriter

resetStream

public void resetStream()

destroy

public void destroy()

write

public void write(int b)
           throws java.io.IOException
Description copied from class: java.io.FilterOutputStream
This method writes a single byte of output to the underlying OutputStream.


write

public void write(byte[] b)
           throws java.io.IOException
Description copied from class: java.io.FilterOutputStream
This method writes all the bytes in the specified array to the underlying OutputStream. It does this by calling the three parameter version of this method - write(byte[], int, int) in this class instead of writing to the underlying OutputStream directly. This allows most subclasses to avoid overriding this method.


write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Description copied from class: java.io.FilterOutputStream
This method calls the write(int) method len times for all bytes from the array buf starting at index offset. Subclasses should overwrite this method to get a more efficient implementation.


flush

public void flush()
           throws java.io.IOException
Description copied from class: java.io.FilterOutputStream
This method attempt to flush all buffered output to be written to the underlying output sink.


close

public void close()
           throws java.io.IOException
Close the stream.