Class BufferedBodyOutputStream
java.lang.Object
java.io.OutputStream
org.glassfish.jersey.jdk.connector.internal.BodyOutputStream
org.glassfish.jersey.jdk.connector.internal.BufferedBodyOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteArrayOutputStream
private BufferedBodyOutputStream.Mode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
isReady()
Returns true if data can be written without blocking else returns false.void
setWriteListener
(WriteListener writeListener) Instructs the stream to invoke the providedWriteListener
when it is possible to write.(package private) ByteBuffer
toBuffer()
void
write
(int b) Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write, write
-
Field Details
-
buffer
-
mode
-
-
Constructor Details
-
BufferedBodyOutputStream
BufferedBodyOutputStream()
-
-
Method Details
-
setWriteListener
Description copied from class:BodyOutputStream
Instructs the stream to invoke the providedWriteListener
when it is possible to write. If the stream is in UNDECIDED state, invoking this method will commit the stream to ASYNCHRONOUS mode.- Specified by:
setWriteListener
in classBodyOutputStream
- Parameters:
writeListener
- theWriteListener
that should be notified when it's possible to write.
-
isReady
public boolean isReady()Description copied from class:BodyOutputStream
Returns true if data can be written without blocking else returns false. If the stream is in ASYNCHRONOUS mode and the user attempts to write to it even though this method returns false, anIllegalStateException
is thrown.- Specified by:
isReady
in classBodyOutputStream
- Returns:
true
if data can be obtained without blocking, otherwise returnsfalse
.
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
toBuffer
ByteBuffer toBuffer()
-