com.sun.grizzly.nio.transport
Class UDPNIOStreamWriter

java.lang.Object
  extended by com.sun.grizzly.streams.AbstractStreamWriter
      extended by com.sun.grizzly.nio.transport.UDPNIOStreamWriter
All Implemented Interfaces:
AddressableStreamWriter<SocketAddress>, StreamWriter, Closeable

public class UDPNIOStreamWriter
extends AbstractStreamWriter
implements AddressableStreamWriter<SocketAddress>

Author:
Alexey Stashok

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.grizzly.streams.AbstractStreamWriter
AbstractStreamWriter.DisposeBufferCompletionHandler
 
Field Summary
 
Fields inherited from class com.sun.grizzly.streams.AbstractStreamWriter
buffer, bufferSize, ZERO, ZERO_READY_FUTURE
 
Constructor Summary
UDPNIOStreamWriter(UDPNIOConnection connection)
           
 
Method Summary
protected  Future<Integer> close0(CompletionHandler<Integer> completionHandler)
           
 Future<Integer> flush(CompletionHandler<Integer> completionHandler)
          Cause the overflow handler to be called even if buffer is not full.
 Future<Integer> flush(SocketAddress peerAddress, CompletionHandler<Integer> completionHandler)
          Flush data to the specific destination address.
protected  Future<Integer> flush0(Buffer current, CompletionHandler<Integer> completionHandler)
           
 SocketAddress getPeerAddress()
          Get the destination address, where the data will be sent on next flush.
 void setPeerAddress(SocketAddress peerAddress)
          Set the destination address, where the data will be sent on next flush.
 
Methods inherited from class com.sun.grizzly.streams.AbstractStreamWriter
close, close, ensure, flush, getBuffer, getBufferSize, getConnection, getTimeout, isBlocking, newBuffer, overflow, overflow, setBlocking, setBufferSize, setConnection, setTimeout, writeBoolean, writeBooleanArray, writeBuffer, writeBuffer, writeByte, writeByteArray, writeByteArray, writeChar, writeCharArray, writeDouble, writeDoubleArray, writeFloat, writeFloatArray, writeInt, writeIntArray, writeLong, writeLongArray, writeShort, writeShortArray, writeStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.grizzly.streams.StreamWriter
close, flush, getBuffer, getBufferSize, getConnection, getTimeout, isBlocking, setBlocking, setBufferSize, setTimeout, writeBoolean, writeBooleanArray, writeBuffer, writeByte, writeByteArray, writeByteArray, writeChar, writeCharArray, writeDouble, writeDoubleArray, writeFloat, writeFloatArray, writeInt, writeIntArray, writeLong, writeLongArray, writeShort, writeShortArray, writeStream
 
Methods inherited from interface java.io.Closeable
close
 

Constructor Detail

UDPNIOStreamWriter

public UDPNIOStreamWriter(UDPNIOConnection connection)
Method Detail

flush

public Future<Integer> flush(SocketAddress peerAddress,
                             CompletionHandler<Integer> completionHandler)
                      throws IOException
Description copied from interface: AddressableStreamWriter
Flush data to the specific destination address.

Specified by:
flush in interface AddressableStreamWriter<SocketAddress>
Parameters:
peerAddress - the destination address, where the data will be sent on next flush.
completionHandler - CompletionHandler, which will get updated with the flush operation state.
Returns:
Future, which could be checked to get flush operation state.
Throws:
IOException

flush

public Future<Integer> flush(CompletionHandler<Integer> completionHandler)
                      throws IOException
Description copied from class: AbstractStreamWriter
Cause the overflow handler to be called even if buffer is not full.

Specified by:
flush in interface StreamWriter
Overrides:
flush in class AbstractStreamWriter
Throws:
IOException

flush0

protected Future<Integer> flush0(Buffer current,
                                 CompletionHandler<Integer> completionHandler)
                          throws IOException
Specified by:
flush0 in class AbstractStreamWriter
Throws:
IOException

close0

protected Future<Integer> close0(CompletionHandler<Integer> completionHandler)
                          throws IOException
Specified by:
close0 in class AbstractStreamWriter
Throws:
IOException

getPeerAddress

public SocketAddress getPeerAddress()
Description copied from interface: AddressableStreamWriter
Get the destination address, where the data will be sent on next flush.

Specified by:
getPeerAddress in interface AddressableStreamWriter<SocketAddress>
Returns:
the destination address, where the data will be sent on next flush.

setPeerAddress

public void setPeerAddress(SocketAddress peerAddress)
Description copied from interface: AddressableStreamWriter
Set the destination address, where the data will be sent on next flush.

Specified by:
setPeerAddress in interface AddressableStreamWriter<SocketAddress>
Parameters:
peerAddress - the destination address, where the data will be sent on next flush.


Copyright © 2009 SUN Microsystems. All Rights Reserved.