org.glassfish.grizzly
Interface Writer<L>

All Known Subinterfaces:
AsyncQueueWriter<L>
All Known Implementing Classes:
AbstractNIOAsyncQueueWriter, AbstractWriter, TCPNIOAsyncQueueWriter, TCPNIOTemporarySelectorWriter, TemporarySelectorWriter, UDPNIOAsyncQueueWriter, UDPNIOTemporarySelectorWriter

public interface Writer<L>

Implementations of this interface are able to write data from a Buffer to Connection. There are two basic Writer implementations in Grizzly: AsyncQueueWriter, TemporarySelectorWriter.

Author:
Alexey Stashok

Method Summary
 GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection, Buffer buffer)
          Method writes the buffer.
 GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection, Buffer buffer, CompletionHandler<WriteResult<Buffer,L>> completionHandler)
          Method writes the buffer.
 GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection, L dstAddress, Buffer buffer)
          Method writes the buffer to the specific address.
 GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection, L dstAddress, Buffer buffer, CompletionHandler<WriteResult<Buffer,L>> completionHandler)
          Method writes the buffer to the specific address.
 GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection, L dstAddress, Buffer buffer, CompletionHandler<WriteResult<Buffer,L>> completionHandler, Interceptor<WriteResult<Buffer,L>> interceptor)
          Method writes the buffer to the specific address.
 

Method Detail

write

GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection,
                                           Buffer buffer)
                                           throws java.io.IOException
Method writes the buffer.

Parameters:
connection - the Connection to write to
buffer - the buffer, from which the data will be written
Returns:
Future, using which it's possible to check the result
Throws:
java.io.IOException

write

GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection,
                                           Buffer buffer,
                                           CompletionHandler<WriteResult<Buffer,L>> completionHandler)
                                           throws java.io.IOException
Method writes the buffer.

Parameters:
connection - the Connection to write to
buffer - the buffer, from which the data will be written
completionHandler - CompletionHandler, which will get notified, when write will be completed
Returns:
Future, using which it's possible to check the result
Throws:
java.io.IOException

write

GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection,
                                           L dstAddress,
                                           Buffer buffer)
                                           throws java.io.IOException
Method writes the buffer to the specific address.

Parameters:
connection - the Connection to write to
dstAddress - the destination address the buffer will be sent to
buffer - the buffer, from which the data will be written
Returns:
Future, using which it's possible to check the result
Throws:
java.io.IOException

write

GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection,
                                           L dstAddress,
                                           Buffer buffer,
                                           CompletionHandler<WriteResult<Buffer,L>> completionHandler)
                                           throws java.io.IOException
Method writes the buffer to the specific address.

Parameters:
connection - the Connection to write to
dstAddress - the destination address the buffer will be sent to
buffer - the buffer, from which the data will be written
completionHandler - CompletionHandler, which will get notified, when write will be completed
Returns:
Future, using which it's possible to check the result
Throws:
java.io.IOException

write

GrizzlyFuture<WriteResult<Buffer,L>> write(Connection connection,
                                           L dstAddress,
                                           Buffer buffer,
                                           CompletionHandler<WriteResult<Buffer,L>> completionHandler,
                                           Interceptor<WriteResult<Buffer,L>> interceptor)
                                           throws java.io.IOException
Method writes the buffer to the specific address.

Parameters:
connection - the Connection to write to
dstAddress - the destination address the buffer will be sent to
buffer - the buffer, from which the data will be written
completionHandler - CompletionHandler, which will get notified, when write will be completed
interceptor - Interceptor, which will be able to intercept control each time new portion of a data was written from a buffer. The interceptor can decide, whether asynchronous write is completed or not, or provide other processing instructions.
Returns:
Future, using which it's possible to check the result
Throws:
java.io.IOException


Copyright © 2011 Oracle Corpration. All Rights Reserved.