org.mortbay.http
Class BufferedOutputStream
java.lang.Object
|
+--java.io.OutputStream
|
+--org.mortbay.util.ByteBufferOutputStream
|
+--org.mortbay.http.BufferedOutputStream
- All Implemented Interfaces:
- HttpMessage.HeaderWriter
- Direct Known Subclasses:
- AJP13OutputStream, ChunkingOutputStream
- public class BufferedOutputStream
- extends ByteBufferOutputStream
- implements HttpMessage.HeaderWriter
Buffered Output Stream.
Uses ByteBufferOutputStream to allow pre and post writes.
- Version:
- $Revision: 1.4 $
- Author:
- Greg Wilkins (gregw)
Constructor Summary |
BufferedOutputStream(java.io.OutputStream out,
int capacity,
int headerReserve,
int preReserve,
int postReserve)
Constructor. |
Methods inherited from class org.mortbay.util.ByteBufferOutputStream |
bufferSize, capacity, ensureCapacity, ensureReserve, ensureSize, ensureSize, ensureSpareCapacity, isFixed, postReserve, postwrite, preReserve, prewrite, prewrite, prewrite, reset, setFixed, size, spareCapacity, write, writeTo |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BufferedOutputStream
public BufferedOutputStream(java.io.OutputStream out,
int capacity,
int headerReserve,
int preReserve,
int postReserve)
- Constructor.
- Parameters:
out
- the OutputStream to buffer to.capacity
- Buffer capacity.headerReserve
- The reserve of bytes for prepending to be used
for the first buffer after resetpreReserve
- The reserve of bytes for prependingpostReserve
- The reserve of bytes for appending
getOutputStream
public java.io.OutputStream getOutputStream()
getCommitObserver
public OutputObserver getCommitObserver()
- Returns:
- OutputObserver to receives commit events from this stream.
setCommitObserver
public void setCommitObserver(OutputObserver commitObserver)
- Parameters:
commitObserver
- OutputObserver to receives commit events from this stream.
isCommitted
public boolean isCommitted()
getBypassBuffer
public boolean getBypassBuffer()
- Returns:
- If true, the buffer is bypassed for large writes
to a committed stream.
setBypassBuffer
public void setBypassBuffer(boolean bypassBuffer)
- Parameters:
bypassBuffer
- If true, the buffer is bypassed for large writes
to a committed stream.
writeHeader
public void writeHeader(HttpMessage httpMessage)
throws java.io.IOException
- Specified by:
writeHeader
in interface HttpMessage.HeaderWriter
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Overrides:
write
in class ByteBufferOutputStream
java.io.IOException
write
public void write(byte[] b,
int offset,
int length)
throws java.io.IOException
- Overrides:
write
in class ByteBufferOutputStream
java.io.IOException
flush
public void flush()
throws java.io.IOException
- This implementation calls the commitObserver on the first flush since
construction or reset.
- Overrides:
flush
in class ByteBufferOutputStream
java.io.IOException
close
public void close()
throws java.io.IOException
- Overrides:
close
in class ByteBufferOutputStream
java.io.IOException
resetStream
public void resetStream()
- Overrides:
resetStream
in class ByteBufferOutputStream
destroy
public void destroy()
- Overrides:
destroy
in class ByteBufferOutputStream
Copyright ? 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.