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
IllegalStateException
public 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
IOException
public boolean isNullOutput() throws IOException
IOException
public void setChunking()
public boolean isChunking()
public void resetStream() throws IOException, IllegalStateException
IllegalStateException
- The stream cannot be
reset if chunking is enabled.IOException
public void destroy()
public void writeHeader(HttpMessage httpMessage) throws IOException
writeHeader
in interface HttpMessage.HeaderWriter
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
protected void checkOutput()
protected int prepareOutput(int length) throws IOException
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public boolean isClosed() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void outputNotify(OutputStream out, int action, Object ignoredData) throws IOException
outputNotify
in interface OutputObserver
out
- The OutputStream that caused the eventaction
- The action takenignoredData
- Data associated with the event.IOException
public void write(InputStream in, int len) throws IOException
IOException
public Writer getWriter(String encoding) throws IOException
IOException
Copyright © 2016. All Rights Reserved.