net.named_data.jndn.transport
public abstract class Transport extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Transport.ConnectionInfo
A Transport.ConnectionInfo is a base class for connection information used
by subclasses of Transport.
|
Constructor and Description |
---|
Transport() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection.
|
void |
connect(Transport.ConnectionInfo connectionInfo,
ElementListener elementListener,
Runnable onConnected)
Connect according to the info in ConnectionInfo, and use elementListener.
|
boolean |
getIsConnected()
Check if the transport is connected.
|
abstract boolean |
isAsync()
Check if this transport is async where connect needs to use the onConnected
callback.
|
abstract boolean |
isLocal(Transport.ConnectionInfo connectionInfo)
Determine whether this transport connecting according to connectionInfo is
to a node on the current machine.
|
abstract void |
processEvents()
Process any data to receive.
|
void |
send(ByteBuffer data)
Send data to the host
|
public abstract boolean isLocal(Transport.ConnectionInfo connectionInfo) throws IOException
connectionInfo
- A ConnectionInfo with the host to check.IOException
public abstract boolean isAsync()
public void connect(Transport.ConnectionInfo connectionInfo, ElementListener elementListener, Runnable onConnected) throws IOException
connectionInfo
- An object of a subclass of ConnectionInfo.elementListener
- The ElementListener must remain valid during the
life of this object.onConnected
- If not null, this calls onConnected.run() when the
connection is established. This is needed if isAsync() is true.IOException
- For I/O error.public void send(ByteBuffer data) throws IOException
data
- The buffer of data to send. This reads from position() to
limit(), but does not change the position.IOException
- For I/O error.public abstract void processEvents() throws IOException, EncodingException
IOException
- For I/O error.EncodingException
- For invalid encoding.public boolean getIsConnected() throws IOException
IOException
public void close() throws IOException
IOException
- For I/O error.Copyright © 2016. All rights reserved.