sunlabs.brazil.server
Class Request.HttpOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by sunlabs.brazil.server.Request.HttpOutputStream
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
BServletRequest.HttpOutputStream
Enclosing class:
Request

public static class Request.HttpOutputStream
extends FilterOutputStream

The HttpOutputStream provides the convenience method writeBytes for writing the byte representation of a string, without bringing in the overhead and the deprecated warnings associated with a java.io.DataOutputStream.

The other methods in this class are here to allow the FilterHandler and ChainSawHandler to alter the behavior in an implementation specific way. This behavior is unfortunate, and might go away when a better strategy comes along.


Field Summary
 int bytesWritten
          Count the number of bytes that are written to this stream
 
Constructor Summary
Request.HttpOutputStream(OutputStream out)
           
 
Method Summary
 boolean canChunk()
          By default, http/1.1 output streams support chunking.
 void sendHeaders(Request request)
           
 void write(byte b)
           
 void write(byte[] buf, int off, int len)
           
 void writeBytes(String s)
           
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytesWritten

public int bytesWritten
Count the number of bytes that are written to this stream

Constructor Detail

Request.HttpOutputStream

public Request.HttpOutputStream(OutputStream out)
Method Detail

writeBytes

public void writeBytes(String s)
                throws IOException
Throws:
IOException

write

public void write(byte b)
           throws IOException
Throws:
IOException

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

sendHeaders

public void sendHeaders(Request request)
                 throws IOException
Throws:
IOException

canChunk

public boolean canChunk()
By default, http/1.1 output streams support chunking. If further output processing is required, then the chunking gets in the way. Allow my subclasses to turn chunking off. The downstream processing functions need to insure valid http/1.1 in than case.


Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.