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:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
class BufferedBodyOutputStream extends BodyOutputStream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBufferedBodyOutputStream.Mode
-
Field Summary
Fields Modifier and Type Field Description private java.io.ByteArrayOutputStreambufferprivate BufferedBodyOutputStream.Modemode
-
Constructor Summary
Constructors Constructor Description BufferedBodyOutputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisReady()Returns true if data can be written without blocking else returns false.voidsetWriteListener(WriteListener writeListener)Instructs the stream to invoke the providedWriteListenerwhen it is possible to write.(package private) java.nio.ByteBuffertoBuffer()voidwrite(int b)
-
-
-
Field Detail
-
buffer
private final java.io.ByteArrayOutputStream buffer
-
mode
private volatile BufferedBodyOutputStream.Mode mode
-
-
Method Detail
-
setWriteListener
public void setWriteListener(WriteListener writeListener)
Description copied from class:BodyOutputStreamInstructs the stream to invoke the providedWriteListenerwhen it is possible to write. If the stream is in UNDECIDED state, invoking this method will commit the stream to ASYNCHRONOUS mode.- Specified by:
setWriteListenerin classBodyOutputStream- Parameters:
writeListener- theWriteListenerthat should be notified when it's possible to write.
-
isReady
public boolean isReady()
Description copied from class:BodyOutputStreamReturns 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, anIllegalStateExceptionis thrown.- Specified by:
isReadyin classBodyOutputStream- Returns:
trueif data can be obtained without blocking, otherwise returnsfalse.
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
toBuffer
java.nio.ByteBuffer toBuffer()
-
-