|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.nio.AbstractNIOConnection
com.sun.grizzly.nio.transport.UDPNIOConnection
public class UDPNIOConnection
Connection implementation
for the UDPNIOTransport
| Field Summary |
|---|
| Fields inherited from class com.sun.grizzly.nio.AbstractNIOConnection |
|---|
asyncReadQueue, asyncWriteQueue, attributes, channel, isBlocking, isClosed, processor, processorSelector, readBufferSize, selectionKey, selectorRunner, transport, writeBufferSize |
| Constructor Summary | |
|---|---|
UDPNIOConnection(UDPNIOTransport transport,
DatagramChannel channel)
|
|
| Method Summary | |
|---|---|
SocketAddress |
getLocalAddress()
Returns the local address of this Connection, or null if it is unconnected. |
SocketAddress |
getPeerAddress()
Returns the address of the endpoint this Connection is connected to, or null if it is unconnected. |
StreamReader |
getStreamReader()
Get the Connection StreamReader, to read data from the
Connection. |
StreamWriter |
getStreamWriter()
Get the Connection StreamWriter, to write data to the
Connection. |
boolean |
isConnected()
|
protected void |
preClose()
|
Future<ReadResult<Buffer,SocketAddress>> |
read(Buffer buffer,
CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler,
Condition<ReadResult<Buffer,SocketAddress>> condition)
Method reads data to the buffer. |
Future |
register()
|
void |
setReadBufferSize(int readBufferSize)
Set the default size of Buffers, which will be allocated for
reading data from Connection. |
protected void |
setSelectionKey(SelectionKey selectionKey)
|
protected void |
setSelectorRunner(SelectorRunner selectorRunner)
|
void |
setWriteBufferSize(int writeBufferSize)
Set the default size of Buffers, which will be allocated for
writing data to Connection. |
Future<WriteResult<Buffer,SocketAddress>> |
write(SocketAddress dstAddress,
Buffer buffer,
CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler)
Method writes the buffer to the specific address. |
| Methods inherited from class com.sun.grizzly.nio.AbstractNIOConnection |
|---|
close, configureBlocking, disableIOEvent, enableIOEvent, getAsyncReadQueue, getAsyncWriteQueue, getAttributes, getChannel, getProcessor, getProcessorSelector, getReadBufferSize, getSelectionKey, getSelectorRunner, getTransport, getWriteBufferSize, isBlocking, isOpen, obtainAttributes, read, read, read, setChannel, setProcessor, setProcessorSelector, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UDPNIOConnection(UDPNIOTransport transport,
DatagramChannel channel)
| Method Detail |
|---|
public boolean isConnected()
public Future register()
throws IOException
IOExceptionprotected void setSelectionKey(SelectionKey selectionKey)
setSelectionKey in class AbstractNIOConnectionprotected void setSelectorRunner(SelectorRunner selectorRunner)
setSelectorRunner in class AbstractNIOConnectionpublic StreamReader getStreamReader()
ConnectionConnection StreamReader, to read data from the
Connection.
Connection StreamReader, to read data from the
Connection.public StreamWriter getStreamWriter()
ConnectionConnection StreamWriter, to write data to the
Connection.
Connection StreamWriter, to write data to the
Connection.protected void preClose()
preClose in class AbstractNIOConnectionpublic SocketAddress getPeerAddress()
public SocketAddress getLocalAddress()
public void setReadBufferSize(int readBufferSize)
ConnectionBuffers, which will be allocated for
reading data from Connection.
setReadBufferSize in interface Connection<SocketAddress>setReadBufferSize in class AbstractNIOConnectionreadBufferSize - the default size of Buffers, which will
be allocated for reading data from Connection.public void setWriteBufferSize(int writeBufferSize)
ConnectionBuffers, which will be allocated for
writing data to Connection.
setWriteBufferSize in interface Connection<SocketAddress>setWriteBufferSize in class AbstractNIOConnectionwriteBufferSize - the default size of Buffers, which will
be allocated for writing data to Connection.
public Future<ReadResult<Buffer,SocketAddress>> read(Buffer buffer,
CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler,
Condition<ReadResult<Buffer,SocketAddress>> condition)
throws IOException
Readable
buffer - the buffer, where data will be readcompletionHandler - CompletionHandler,
which will get notified, when read will be completedcondition - Condition, which will be checked
each time new portion of a data was read to a buffer.
The condition can decide, whether asynchronous read is
completed or not.
Future, using which it's possible to check the result
IOException
public Future<WriteResult<Buffer,SocketAddress>> write(SocketAddress dstAddress,
Buffer buffer,
CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler)
throws IOException
Writable
dstAddress - the destination address the buffer will be
sent tobuffer - the buffer, from which the data will be writtencompletionHandler - CompletionHandler,
which will get notified, when write will be completed
Future, using which it's possible to check the
result
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||