class BufferedBodyOutputStream extends BodyOutputStream
Modifier and Type | Class and Description |
---|---|
private static class |
BufferedBodyOutputStream.Mode |
Modifier and Type | Field and Description |
---|---|
private java.io.ByteArrayOutputStream |
buffer |
private BufferedBodyOutputStream.Mode |
mode |
Constructor and Description |
---|
BufferedBodyOutputStream() |
Modifier and Type | Method and Description |
---|---|
boolean |
isReady()
Returns true if data can be written without blocking else returns
false.
|
void |
setWriteListener(WriteListener writeListener)
Instructs the stream to invoke the provided
WriteListener when it is possible to write. |
(package private) java.nio.ByteBuffer |
toBuffer() |
void |
write(int b) |
private final java.io.ByteArrayOutputStream buffer
private volatile BufferedBodyOutputStream.Mode mode
public void setWriteListener(WriteListener writeListener)
BodyOutputStream
WriteListener
when it is possible to write.
If the stream is in UNDECIDED state, invoking this method will commit the stream to ASYNCHRONOUS mode.setWriteListener
in class BodyOutputStream
writeListener
- the WriteListener
that should be notified
when it's possible to write.public boolean isReady()
BodyOutputStream
IllegalStateException
is thrown.isReady
in class BodyOutputStream
true
if data can be obtained without blocking,
otherwise returns false
.public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
java.nio.ByteBuffer toBuffer()