Top Description Constructors Methods
org.glassfish.tyrus.spi

public abstract Class Writer

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, java.nio.ByteBuffer

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 after a successful upgrade.

Author
Pavel Bucek

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
write(ByteBuffer
bytes to write.
buffer
,
CompletionHandler<ByteBuffer>
completion handler to know the write status.
completionHandler
)

A backward compatible method called from write(ByteBuffer, CompletionHandler, WriterInfo) to handover the data for a connection to the transport.

public void
write(ByteBuffer
bytes to write.
buffer
,
CompletionHandler<ByteBuffer>
completion handler to know the write status.
completionHandler
,
WriterInfo
additional information about the data to be written.
writerInfo
)

Tyrus runtime calls this method to handover the data for a connection to the transport.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Writerback to summary
public Writer()

Method Detail

writeback to summary
public abstract void write(ByteBuffer buffer, CompletionHandler<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:ByteBuffer

bytes to write.

completionHandler:CompletionHandler<ByteBuffer>

completion handler to know the write status.

writeback to summary
public void write(ByteBuffer buffer, CompletionHandler<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:ByteBuffer

bytes to write.

completionHandler:CompletionHandler<ByteBuffer>

completion handler to know the write status.

writerInfo:WriterInfo

additional information about the data to be written.

Since
1.17