org.mortbay.http
Class ChunkingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.mortbay.util.ByteBufferOutputStream
          extended by org.mortbay.http.BufferedOutputStream
              extended by org.mortbay.http.ChunkingOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, HttpMessage.HeaderWriter

public class ChunkingOutputStream
extends BufferedOutputStream
implements HttpMessage.HeaderWriter

HTTP Chunking OutputStream.

Version:
$Id: ChunkingOutputStream.java,v 1.6 2004/10/19 00:27:23 gregwilkins Exp $
Author:
Greg Wilkins

Field Summary
 
Fields inherited from class org.mortbay.http.BufferedOutputStream
_httpMessageWriter, _out
 
Fields inherited from class org.mortbay.util.ByteBufferOutputStream
_buf
 
Constructor Summary
ChunkingOutputStream(java.io.OutputStream outputStream, int bufferSize, int headerReserve)
          Constructor.
ChunkingOutputStream(java.io.OutputStream outputStream, int bufferSize, int headerReserve, boolean chunking)
          Constructor.
 
Method Summary
protected  void bypassWrite(byte[] b, int offset, int length)
           
 void close()
           
 boolean isChunking()
           
 void resetStream()
           
 void setChunking(boolean chunking)
           
protected  void wrapBuffer()
          Wrap Buffer.
 
Methods inherited from class org.mortbay.http.BufferedOutputStream
destroy, flush, getBypassBuffer, getCommitObserver, getOutputStream, isCommitted, setBypassBuffer, setCommitObserver, write, write, writeHeader
 
Methods inherited from class org.mortbay.util.ByteBufferOutputStream
bufferSize, capacity, ensureCapacity, ensureReserve, ensureSize, ensureSize, ensureSpareCapacity, isFixed, postReserve, postwrite, postwrite, preReserve, prewrite, prewrite, prewrite, reset, setFixed, size, spareCapacity, write, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mortbay.http.HttpMessage.HeaderWriter
writeHeader
 

Constructor Detail

ChunkingOutputStream

public ChunkingOutputStream(java.io.OutputStream outputStream,
                            int bufferSize,
                            int headerReserve)
Constructor.

Parameters:
outputStream - The outputStream to buffer or chunk to.

ChunkingOutputStream

public ChunkingOutputStream(java.io.OutputStream outputStream,
                            int bufferSize,
                            int headerReserve,
                            boolean chunking)
Constructor.

Parameters:
outputStream - The outputStream to buffer or chunk to.
Method Detail

isChunking

public boolean isChunking()

setChunking

public void setChunking(boolean chunking)

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class BufferedOutputStream
Throws:
java.io.IOException

resetStream

public void resetStream()
Overrides:
resetStream in class BufferedOutputStream

wrapBuffer

protected void wrapBuffer()
                   throws java.io.IOException
Description copied from class: BufferedOutputStream
Wrap Buffer. Called by flush() to allow the data in the buffer to be pre and post written for any protocol wrapping. The default implementation does nothing.

Overrides:
wrapBuffer in class BufferedOutputStream
Throws:
java.io.IOException

bypassWrite

protected void bypassWrite(byte[] b,
                           int offset,
                           int length)
                    throws java.io.IOException
Overrides:
bypassWrite in class BufferedOutputStream
Throws:
java.io.IOException


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.