public class HttpOutputStream extends OutputStream implements OutputObserver, HttpMessage.HeaderWriter
| Modifier and Type | Field and Description |
|---|---|
static Class[] |
__filterArg |
__CLOSED, __CLOSING, __COMMITING, __FIRST_WRITE, __RESET_BUFFER| Constructor and Description |
|---|
HttpOutputStream(OutputStream outputStream)
Constructor.
|
HttpOutputStream(OutputStream outputStream,
int bufferSize)
Constructor.
|
HttpOutputStream(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,
Object data)
Add an Output Observer.
|
protected void |
checkOutput() |
void |
close()
Close the stream.
|
void |
destroy() |
void |
flush() |
OutputStream |
getBufferedOutputStream()
Get the buffered output stream.
|
int |
getBufferSize()
Get the output buffer capacity.
|
int |
getBytesWritten() |
OutputStream |
getOutputStream()
Get the backing output stream.
|
Writer |
getWriter(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(OutputStream out,
int action,
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) |
String |
toString() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(InputStream in,
int len) |
void |
write(int b) |
void |
writeHeader(HttpMessage httpMessage) |
public static final Class[] __filterArg
public HttpOutputStream(OutputStream outputStream)
outputStream - The outputStream to buffer or chunk to.public HttpOutputStream(OutputStream outputStream, int bufferSize)
outputStream - The outputStream to buffer or chunk to.public HttpOutputStream(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 OutputStream getOutputStream()
public OutputStream getBufferedOutputStream()
public boolean isWritten()
public int getBufferSize()
public void setBufferSize(int size)
throws IllegalStateException
size - Minimum buffer size in bytesIllegalStateException - If output has been written.public int getBytesWritten()
public void resetBuffer()
throws IllegalStateException
IllegalStateExceptionpublic void addObserver(OutputObserver observer)
observer - The observer.public void addObserver(OutputObserver observer, Object data)
observer - The observer.data - Data to be passed wit notify calls.public void resetObservers()
public void nullOutput()
throws IOException
IOExceptionpublic boolean isNullOutput()
throws IOException
IOExceptionpublic void setChunking()
public boolean isChunking()
public void resetStream()
throws IOException,
IllegalStateException
IllegalStateException - The stream cannot be
reset if chunking is enabled.IOExceptionpublic void destroy()
public void writeHeader(HttpMessage httpMessage) throws IOException
writeHeader in interface HttpMessage.HeaderWriterIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionprotected void checkOutput()
protected int prepareOutput(int length)
throws IOException
IOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic boolean isClosed()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void outputNotify(OutputStream out, int action, Object ignoredData) throws IOException
outputNotify in interface OutputObserverout - The OutputStream that caused the eventaction - The action takenignoredData - Data associated with the event.IOExceptionpublic void write(InputStream in, int len) throws IOException
IOExceptionpublic Writer getWriter(String encoding) throws IOException
IOExceptionCopyright © 2015. All Rights Reserved.