Class SocketChannel

java.lang.Object
  extended by SocketChannel
All Implemented Interfaces:
ObjectChannel

public class SocketChannel
extends java.lang.Object
implements ObjectChannel

SocketChannel. This class creates a communication channel using a socket.

Author:
Akitoshi Yoshida., Heinz Kredel.

Field Summary
private  java.io.ObjectInputStream in
          input stream from the socket.
private  java.io.ObjectOutputStream out
          output stream to the socket.
private  java.net.Socket soc
          socket.
 
Constructor Summary
SocketChannel(java.net.Socket s)
          Constructs a socket channel on the given socket s.
 
Method Summary
private  boolean checkOrder(java.net.Socket s)
           
 void close()
          Closes the channel.
 java.lang.Object receive()
          Receives an object.
 void send(java.lang.Object v)
          Sends an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private java.io.ObjectInputStream in
input stream from the socket.


out

private java.io.ObjectOutputStream out
output stream to the socket.


soc

private java.net.Socket soc
socket.

Constructor Detail

SocketChannel

public SocketChannel(java.net.Socket s)
              throws java.io.IOException
Constructs a socket channel on the given socket s.

Parameters:
s - socket.
Throws:
java.io.IOException
Method Detail

send

public void send(java.lang.Object v)
          throws java.io.IOException
Sends an object.

Specified by:
send in interface ObjectChannel
Throws:
java.io.IOException

receive

public java.lang.Object receive()
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
Receives an object.

Specified by:
receive in interface ObjectChannel
Throws:
java.io.IOException
java.lang.ClassNotFoundException

close

public void close()
Closes the channel.

Specified by:
close in interface ObjectChannel

checkOrder

private boolean checkOrder(java.net.Socket s)
                    throws java.io.IOException
Throws:
java.io.IOException