public class HttpOutputStream extends java.io.OutputStream implements OutputObserver, HttpMessage.HeaderWriter
Modifier and Type | Field and Description |
---|---|
static java.lang.Class[] |
__filterArg |
__CLOSED, __CLOSING, __COMMITING, __FIRST_WRITE, __RESET_BUFFER
Constructor and Description |
---|
HttpOutputStream(java.io.OutputStream outputStream)
Constructor.
|
HttpOutputStream(java.io.OutputStream outputStream,
int bufferSize)
Constructor.
|
HttpOutputStream(java.io.OutputStream outputStream,
int bufferSize,
int headerReserve)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(OutputObserver observer)
Add an Output Observer.
|
void |
addObserver(OutputObserver observer,
java.lang.Object data)
Add an Output Observer.
|
protected void |
checkOutput() |
void |
close()
Close the stream.
|
void |
destroy() |
void |
flush() |
java.io.OutputStream |
getBufferedOutputStream()
Get the buffered output stream.
|
int |
getBufferSize()
Get the output buffer capacity.
|
int |
getBytesWritten() |
java.io.OutputStream |
getOutputStream()
Get the backing output stream.
|
java.io.Writer |
getWriter(java.lang.String encoding) |
boolean |
isChunking()
Get chunking mode
|
boolean |
isClosed()
Close the stream.
|
boolean |
isNullOutput()
is the output Nulled?
|
boolean |
isWritten()
Has any data been written to the stream.
|
void |
nullOutput()
Null the output.
|
void |
outputNotify(java.io.OutputStream out,
int action,
java.lang.Object ignoredData)
Output Notification.
|
protected int |
prepareOutput(int length) |
void |
resetBuffer()
Reset Buffered output.
|
void |
resetObservers()
Reset the observers.
|
void |
resetStream()
Reset the stream.
|
void |
setBufferedOutputStream(BufferedOutputStream bos) |
void |
setBufferSize(int size)
Set the output buffer size.
|
void |
setChunking()
Set chunking mode.
|
void |
setContentLength(int length) |
java.lang.String |
toString() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(java.io.InputStream in,
int len) |
void |
write(int b) |
void |
writeHeader(HttpMessage httpMessage) |
public HttpOutputStream(java.io.OutputStream outputStream)
outputStream
- The outputStream to buffer or chunk to.public HttpOutputStream(java.io.OutputStream outputStream, int bufferSize)
outputStream
- The outputStream to buffer or chunk to.public HttpOutputStream(java.io.OutputStream outputStream, int bufferSize, int headerReserve)
outputStream
- The outputStream to buffer or chunk to.public void setContentLength(int length)
public void setBufferedOutputStream(BufferedOutputStream bos)
public java.io.OutputStream getOutputStream()
public java.io.OutputStream getBufferedOutputStream()
public boolean isWritten()
public int getBufferSize()
public void setBufferSize(int size) throws java.lang.IllegalStateException
size
- Minimum buffer size in bytesjava.lang.IllegalStateException
- If output has been written.public int getBytesWritten()
public void resetBuffer() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public void addObserver(OutputObserver observer)
observer
- The observer.public void addObserver(OutputObserver observer, java.lang.Object data)
observer
- The observer.data
- Data to be passed wit notify calls.public void resetObservers()
public void nullOutput() throws java.io.IOException
java.io.IOException
public boolean isNullOutput() throws java.io.IOException
java.io.IOException
public void setChunking()
public boolean isChunking()
public void resetStream() throws java.io.IOException, java.lang.IllegalStateException
java.lang.IllegalStateException
- The stream cannot be
reset if chunking is enabled.java.io.IOException
public void destroy()
public void writeHeader(HttpMessage httpMessage) throws java.io.IOException
writeHeader
in interface HttpMessage.HeaderWriter
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
protected void checkOutput()
protected int prepareOutput(int length) throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public boolean isClosed() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void outputNotify(java.io.OutputStream out, int action, java.lang.Object ignoredData) throws java.io.IOException
outputNotify
in interface OutputObserver
out
- The OutputStream that caused the eventaction
- The action takenignoredData
- Data associated with the event.java.io.IOException
public void write(java.io.InputStream in, int len) throws java.io.IOException
java.io.IOException
public java.io.Writer getWriter(java.lang.String encoding) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.