jfreerails.network
Class InetConnection

java.lang.Object
  extended by jfreerails.network.InetConnection

 class InetConnection
extends java.lang.Object

Provides methods send objects over the Internet, and connect and disconnect gracefully.

Author:
Luke

Field Summary
private static java.lang.String CONNECTION_OPEN
           
private  java.io.ObjectInputStream objectInputStream
           
private  java.io.ObjectOutputStream objectOutputStream
           
private  java.net.Socket socket
           
 
Constructor Summary
InetConnection(java.net.Socket acceptedConnection)
           
InetConnection(java.lang.String s, int port)
           
 
Method Summary
(package private)  void flush()
           
(package private)  boolean isOpen()
           
(package private)  void open()
          Sets up the input and output streams, then sends the String "CONNECTION_OPEN" and attempts to read the same String back.
(package private)  FreerailsSerializable receive()
           
(package private)  void send(FreerailsSerializable object)
           
(package private)  void shutdownInput()
           
(package private)  void shutdownOutput()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

private final java.net.Socket socket

objectOutputStream

private java.io.ObjectOutputStream objectOutputStream

objectInputStream

private java.io.ObjectInputStream objectInputStream

CONNECTION_OPEN

private static final java.lang.String CONNECTION_OPEN
See Also:
Constant Field Values
Constructor Detail

InetConnection

InetConnection(java.net.Socket acceptedConnection)
         throws java.io.IOException
Throws:
java.io.IOException

InetConnection

InetConnection(java.lang.String s,
               int port)
         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

open

void open()
    throws java.io.IOException
Sets up the input and output streams, then sends the String "CONNECTION_OPEN" and attempts to read the same String back.

Throws:
java.io.IOException

send

void send(FreerailsSerializable object)
    throws java.io.IOException
Throws:
java.io.IOException

receive

FreerailsSerializable receive()
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

isOpen

boolean isOpen()

flush

void flush()
     throws java.io.IOException
Throws:
java.io.IOException

shutdownOutput

void shutdownOutput()
              throws java.io.IOException
Throws:
java.io.IOException

shutdownInput

void shutdownInput()
             throws java.io.IOException
Throws:
java.io.IOException