com.epam.common.transport
Interface Transport

All Known Subinterfaces:
ClientTransport
All Known Implementing Classes:
NIOSocketTransport, NIOTCPTransport, SocketTransport, SSLTCPTransport, TCPTransport, UDPTransport

public interface Transport

Common transport interface. Provides ability to read and write the messages.


Method Summary
 void close()
          Close the transport.
 String getAddress()
          Getter for address value.
 int getPort()
          Getter for port value.
 boolean isBlockingSocket()
           
 boolean isOpen()
          Returns true if, transport is open.
 void open()
          Open the transport.
 int read(byte[] buffer)
          Transport dependent read method.
 int read(byte[] buffer, int offset, int length)
          Transport dependent read method.
 int read(ByteBuffer buffer)
           
 int read(ByteBuffer buffer, int offset, int length)
           
 void waitUntilReadyToWrite()
           
 void write(byte[] message)
          Transport dependent write method.
 int write(byte[] message, int offset, int length)
          Transport dependent write method.
 int write(ByteBuffer message)
           
 int write(ByteBuffer message, int offset, int length)
           
 

Method Detail

isBlockingSocket

boolean isBlockingSocket()

write

void write(byte[] message)
           throws IOException
Transport dependent write method.

Parameters:
message - actual message
Throws:
IOException - if unable to write

write

int write(ByteBuffer message)
          throws IOException
Throws:
IOException

write

int write(byte[] message,
          int offset,
          int length)
          throws IOException
Transport dependent write method.

Parameters:
message - actual message
offset - the offset in buffer
length - the num of bytes to write
Throws:
IOException - if unable to write

write

int write(ByteBuffer message,
          int offset,
          int length)
          throws IOException
Throws:
IOException

waitUntilReadyToWrite

void waitUntilReadyToWrite()
                           throws IOException
Throws:
IOException

read

int read(byte[] buffer,
         int offset,
         int length)
         throws IOException
Transport dependent read method.

Parameters:
buffer - holder for read bytes
offset - in buffer
length - maximum bytes to be read
Returns:
number of byte actually read
Throws:
IOException - if unable to read

read

int read(ByteBuffer buffer,
         int offset,
         int length)
         throws IOException
Throws:
IOException

read

int read(byte[] buffer)
         throws IOException
Transport dependent read method.

Parameters:
buffer - holder for read bytes
Returns:
number of byte actually read
Throws:
IOException - if unable to read

read

int read(ByteBuffer buffer)
         throws IOException
Throws:
IOException

getAddress

String getAddress()
Getter for address value.


getPort

int getPort()
Getter for port value.


open

void open()
          throws IOException
Open the transport.

Throws:
IOException - - throws if error occurred

close

void close()
           throws IOException
Close the transport.

Throws:
IOException - - throws if error occurred

isOpen

boolean isOpen()
Returns true if, transport is open.



Copyright © 2000-2014 EPAM Systems. All Rights Reserved.