edu.nps.moves.disutil
Class UdpServer.Event

java.lang.Object
  extended by java.util.EventObject
      extended by edu.nps.moves.disutil.UdpServer.Event
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
UdpServer

public static class UdpServer.Event
extends java.util.EventObject

An event representing activity by a UdpServer.

This code is released into the Public Domain. Since this is Public Domain, you don't need to worry about licensing, and you can simply copy this UdpServer.java file to your own package and use it as you like. Enjoy. Please consider leaving the following statement here in this code:

This UdpServer class was copied to this project from its source as found at iHarder.net.

Version:
0.1
Author:
Robert Harder, rharder@users.sourceforge.net
See Also:
UdpServer, UdpServer.Adapter, UdpServer.Listener, Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
UdpServer.Event(UdpServer src)
          Creates a Event based on the given UdpServer.
 
Method Summary
 java.net.DatagramPacket getPacket()
          Returns the most recent datagram packet received by the UdpServer.
 byte[] getPacketAsBytes()
          Copies and returns the bytes in the most recently received packet, or null if not available.
 java.lang.String getPacketAsString()
          Returns the data in the most recently-received packet as if it were a String or null if not available.
 UdpServer.State getState()
          Shorthand for getUdpServer().getState().
 UdpServer getUdpServer()
          Returns the source of the event, a UdpServer.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UdpServer.Event

public UdpServer.Event(UdpServer src)
Creates a Event based on the given UdpServer.

Parameters:
src - the source of the event
Method Detail

getUdpServer

public UdpServer getUdpServer()
Returns the source of the event, a UdpServer. Shorthand for (UdpServer)getSource().

Returns:
the server

getState

public UdpServer.State getState()
Shorthand for getUdpServer().getState().

Returns:
the state of the server
See Also:
UdpServer.State

getPacket

public java.net.DatagramPacket getPacket()
Returns the most recent datagram packet received by the UdpServer. Shorthand for getUdpServer().getPacket().

Returns:
the most recent datagram

getPacketAsBytes

public byte[] getPacketAsBytes()
Copies and returns the bytes in the most recently received packet, or null if not available.

Returns:
a copy of the datagram's byte array

getPacketAsString

public java.lang.String getPacketAsString()
Returns the data in the most recently-received packet as if it were a String or null if not available.

Returns:
The datagram as a string