Package org.glassfish.tyrus.spi
Class Writer
- java.lang.Object
-
- org.glassfish.tyrus.spi.Writer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
GrizzlyWriter
public abstract class Writer extends java.lang.Object implements java.io.Closeable
Writer class that is used by tyrus runtime to pass outbound websocket data for a connection to a transport. Then, the transport actually writes the data eventually.A transport creates implementation of this class and registers the writer object using
WebSocketEngine.UpgradeInfo.createConnection(org.glassfish.tyrus.spi.Writer, org.glassfish.tyrus.spi.Connection.CloseListener)
after a successful upgrade.- Author:
- Pavel Bucek (pavel.bucek at oracle.com)
-
-
Constructor Summary
Constructors Constructor Description Writer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
write(java.nio.ByteBuffer buffer, CompletionHandler<java.nio.ByteBuffer> completionHandler)
A backward compatible method called fromwrite(ByteBuffer, CompletionHandler, WriterInfo)
to handover the data for a connection to the transport.void
write(java.nio.ByteBuffer buffer, CompletionHandler<java.nio.ByteBuffer> completionHandler, WriterInfo writerInfo)
Tyrus runtime calls this method to handover the data for a connection to the transport.
-
-
-
Method Detail
-
write
public abstract void write(java.nio.ByteBuffer buffer, CompletionHandler<java.nio.ByteBuffer> completionHandler)
A backward compatible method called from
write(ByteBuffer, CompletionHandler, WriterInfo)
to handover the data for a connection to the transport. The transport writes bytes to underlying connection. Tyrus runtime must not use the buffer until the write is completed.The method will be removed in the next major version.
- Parameters:
buffer
- bytes to write.completionHandler
- completion handler to know the write status.
-
write
public void write(java.nio.ByteBuffer buffer, CompletionHandler<java.nio.ByteBuffer> completionHandler, WriterInfo writerInfo)
Tyrus runtime calls this method to handover the data for a connection to the transport. The transport writes bytes to underlying connection. Tyrus runtime must not use the buffer until the write is completed.- Parameters:
buffer
- bytes to write.completionHandler
- completion handler to know the write status.writerInfo
- additional information about the data to be written.- Since:
- 1.17
-
-