|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fossilec.odettej.transport.tcp.TCPTransport
public class TCPTransport
Provide OdetteJ with a TCP/IP transportation layer based on Odette FTP,
implementing the Transport
interface.
Used to create new transportion layer or encapsulating a existing opened socket channel to provide its functionalities.
Transport
Constructor Summary | |
---|---|
TCPTransport()
Default constructor method. |
|
TCPTransport(java.nio.channels.SocketChannel channel)
Creates a new class instance providing an existing SocketChannel. |
Method Summary | |
---|---|
boolean |
connect(NetworkAddress address)
Setup a network connection with another Odette FTP entity. |
boolean |
connect(java.lang.String address)
Setup a network connection with another Odette FTP entity. |
void |
disconnect()
Terminate the ongoing connection. |
protected java.nio.channels.SocketChannel |
getChannel()
Gets channel used in streaming with TCP connection. |
java.lang.String |
getLocalAddress()
Returns local address used to fulfill Odette FTP session variables. |
java.lang.String |
getRemoteAddress()
Returns remote address used to fulfill Odette FTP session variables. |
boolean |
isConnected()
Tells whether the underlying transport is connected. |
int |
receive(java.nio.ByteBuffer dest)
Receive a sequence of bytes from the TCP socket channel. |
int |
send(java.nio.ByteBuffer buffer)
Send a sequence of bytes through this transport implementation, using a TCP/IP socket channel, from the given buffer. |
int |
send(java.nio.ByteBuffer[] buffers)
Sent a sequence of bytes through this transport implementation, using a TCP/IP socket channel, from a subsequence of the given buffers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TCPTransport()
OdetteFTPException
public TCPTransport(java.nio.channels.SocketChannel channel) throws OdetteFTPException
channel
- opened socket channel.
OdetteFTPException
Method Detail |
---|
protected java.nio.channels.SocketChannel getChannel() throws OdetteFTPException
SocketChannel
if not set.
OdetteFTPException
public boolean connect(NetworkAddress address) throws OdetteFTPException
connect
in interface Transport
address
- InternetAddress
type address providing the
network location to connect.
true
when connection is established with success,
otherwise return false
.
ConnectionException
- transport already connected
AddressException
- unresolved address or unsupported address type
OdetteFTPException
- unexpected errorTransport.connect(NetworkAddress)
public boolean connect(java.lang.String address) throws OdetteFTPException
connect
in interface Transport
address
- A String representation of the TCP/IP network location of the
target Odette FTP peer. The value is parsed using
InternetAddress
object.
true
when connection is established with success,
otherwise return false
.
ConnectionException
- transport already connected
AddressException
- unresolved address or unsupported address type
OdetteFTPException
- unexpected errorTransport.connect(String)
public void disconnect() throws OdetteFTPException
disconnect
in interface Transport
OdetteFTPException
- unexpected errorTransport.disconnect()
public int send(java.nio.ByteBuffer buffer) throws OdetteFTPException
An attempt is made to send up to r bytes to the channel, where
r is the number of bytes remaining in the buffer, that is,
dst.remaining()
, at the moment this method is invoked.
send
in interface Transport
src
- The buffer from which bytes are to be retrieved
NotConnectedException
- Transport not yet connected
OdetteFTPException
- unexpected exceptionTransport.send(ByteBuffer)
public int send(java.nio.ByteBuffer[] buffers) throws OdetteFTPException
send
in interface Transport
srcs
- The sequence of buffers from which bytes are to be retrieved
NotConnectedException
- Transport not yet connected
OdetteFTPException
- unexpected exceptionTransport.send(ByteBuffer[])
public int receive(java.nio.ByteBuffer dest) throws OdetteFTPException
An attempt is made to receive up to r bytes from the channel,
where r is the number of bytes remaining in the buffer, that is,
dst.remaining()
, at the moment this method is invoked.
receive
in interface Transport
dst
- The buffer into which bytes are to be transferred
-1
if the channel has reached end-of-stream
NotConnectedException
- Transport not yet connected
OdetteFTPException
- Thrown by unexpected exceptionTransport.receive(ByteBuffer)
public boolean isConnected() throws OdetteFTPException
isConnected
in interface Transport
true
if this transport implementation is
connected.
OdetteFTPException
Transport.isConnected()
public java.lang.String getLocalAddress() throws OdetteFTPException
odette.calling-address
"
property. The Responder Odette FTP entity use this method to fill
the "odette.called-address
" property.
getLocalAddress
in interface Transport
OdetteFTPException
Transport.getLocalAddress()
public java.lang.String getRemoteAddress() throws OdetteFTPException
odette.called-address
".
The Responder Odette FTP entity use this method to fill the "odette.calling-address
"
property.
getRemoteAddress
in interface Transport
OdetteFTPException
Transport.getRemoteAddress()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |