com.jme3.network.connection
クラス Connection

java.lang.Object
  上位を拡張 com.jme3.network.connection.Connection
すべての実装されたインタフェース:
java.lang.Runnable
直系の既知のサブクラス:
TCPConnection, UDPConnection

public abstract class Connection
extends java.lang.Object
implements java.lang.Runnable

Base class for a connection method. Extend this if you have some other fancy way of dealing with connections. This class provides basic message handling, connection filtering and handles the selector.


コンストラクタの概要
Connection()
           
 
メソッドの概要
abstract  void accept(java.nio.channels.SelectableChannel channel)
          Accept an incoming connection.
 void addConnectionListener(ConnectionListener listener)
           
 void addConnectorFilter(ConnectorFilter filter)
          Add a connector filter for this connection.
 void addMessageListener(java.lang.Class messageClass, MessageListener listener)
           
 void addMessageListener(MessageListener listener)
           
 void addToDisconnectionQueue(Client client)
           
abstract  void bind(java.net.SocketAddress address)
          Bind to an address.
abstract  void cleanup()
          Called when the connection implementation should clean up.
abstract  void connect(java.nio.channels.SelectableChannel channel)
          Finish the connection.
abstract  void connect(java.net.SocketAddress address)
          Connect to a server using this overload.
 java.util.List<Client> getConnectors()
          Get the combined connectors, meaning TCP and UDP are combined into one client.
 java.util.List<Client> getLocalConnectors()
          Get all the connectors.
 boolean isAlive()
          Return whether this connection is still alive.
abstract  void read(java.nio.channels.SelectableChannel channel)
          Read from the channel.
 void removeConnectionListener(ConnectionListener listener)
           
 void removeConnectorFilter(ConnectorFilter filter)
          Remove a connector filter for this connection.
 void removeMessageListener(java.lang.Class messageClass, MessageListener listener)
           
 void removeMessageListener(MessageListener listener)
           
 void run()
           
abstract  void sendObject(Client connector, java.lang.Object object)
          Send an object to the connector.
abstract  void sendObject(java.lang.Object object)
          Send an object to the server.
 java.lang.String shouldFilterConnector(java.net.InetSocketAddress address)
          Determine whether this connection should be filtered.
abstract  void write(java.nio.channels.SelectableChannel channel)
          Write to a channel.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

Connection

public Connection()
メソッドの詳細

addConnectorFilter

public void addConnectorFilter(ConnectorFilter filter)
Add a connector filter for this connection.

パラメータ:
filter - The filter to add.

removeConnectorFilter

public void removeConnectorFilter(ConnectorFilter filter)
Remove a connector filter for this connection.

パラメータ:
filter - The filter to remove.

shouldFilterConnector

public java.lang.String shouldFilterConnector(java.net.InetSocketAddress address)
Determine whether this connection should be filtered.

パラメータ:
address - The address that should be checked.
戻り値:
The reason if it should be filtered.

run

public void run()
定義:
インタフェース java.lang.Runnable 内の run

getLocalConnectors

public java.util.List<Client> getLocalConnectors()
Get all the connectors.

戻り値:
A unmodifiable list with the connectors.

getConnectors

public java.util.List<Client> getConnectors()
Get the combined connectors, meaning TCP and UDP are combined into one client.

戻り値:
A unmodifiable list with the connectors.

isAlive

public boolean isAlive()
Return whether this connection is still alive.

戻り値:
True if so, false if not.

accept

public abstract void accept(java.nio.channels.SelectableChannel channel)
                     throws java.io.IOException
Accept an incoming connection.

パラメータ:
channel - The channel.
例外:
java.io.IOException - When a problem occurs.

connect

public abstract void connect(java.nio.channels.SelectableChannel channel)
                      throws java.io.IOException
Finish the connection.

パラメータ:
channel - The channel.
例外:
java.io.IOException - When a problem occurs.

read

public abstract void read(java.nio.channels.SelectableChannel channel)
                   throws java.io.IOException
Read from the channel.

パラメータ:
channel - The channel.
例外:
java.io.IOException - When a problem occurs.

write

public abstract void write(java.nio.channels.SelectableChannel channel)
                    throws java.io.IOException
Write to a channel.

パラメータ:
channel - The channel to write to.
例外:
java.io.IOException - When a problem occurs.

connect

public abstract void connect(java.net.SocketAddress address)
                      throws java.io.IOException
Connect to a server using this overload.

パラメータ:
address - The address to connect to.
例外:
java.io.IOException - When a problem occurs.

bind

public abstract void bind(java.net.SocketAddress address)
                   throws java.io.IOException
Bind to an address.

パラメータ:
address - The address to bind to.
例外:
java.io.IOException - When a problem occurs.

sendObject

public abstract void sendObject(java.lang.Object object)
                         throws java.io.IOException
Send an object to the server. If this is a server, it will be broadcast to all clients.

パラメータ:
object - The object to send.
例外:
java.io.IOException - When a writing error occurs.

sendObject

public abstract void sendObject(Client connector,
                                java.lang.Object object)
                         throws java.io.IOException
Send an object to the connector. Server method.

パラメータ:
connector - The connector to send to.
object - The object to send.
例外:
java.io.IOException - When a writing error occurs.

cleanup

public abstract void cleanup()
                      throws java.io.IOException
Called when the connection implementation should clean up.

例外:
java.io.IOException - When a problem occurs.

addToDisconnectionQueue

public void addToDisconnectionQueue(Client client)

addConnectionListener

public void addConnectionListener(ConnectionListener listener)

removeConnectionListener

public void removeConnectionListener(ConnectionListener listener)

addMessageListener

public void addMessageListener(MessageListener listener)

removeMessageListener

public void removeMessageListener(MessageListener listener)

addMessageListener

public void addMessageListener(java.lang.Class messageClass,
                               MessageListener listener)

removeMessageListener

public void removeMessageListener(java.lang.Class messageClass,
                                  MessageListener listener)