com.objectwave.simpleSockets
Class ClientSocket

java.lang.Object
  |
  +--com.objectwave.simpleSockets.ClientSocket

public class ClientSocket
extends java.lang.Object

A Socket Wrapper class.

Version:
1.5.1

Constructor Summary
ClientSocket(java.net.InetAddress addr, int port)
           
ClientSocket(java.net.Socket sock)
           
ClientSocket(java.lang.String host, int port)
           
ClientSocket(java.net.URL url, int port)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 java.io.BufferedInputStream getBufferedInputStream()
           
 java.io.BufferedOutputStream getBufferedOutputStream()
           
 java.net.Socket getSocket()
          There just may be a need to get to the actual socket.
static void main(java.lang.String[] args)
          Methods to test client socket.
 int readInt()
           
 java.lang.Object readObject()
           
 void readOntoStream(java.io.OutputStream outStream)
          Read an unknown amount of bytes from the socket and write them onto the provided output stream.
 java.lang.String readString()
          I could have used readUTF, but this implementation allows for lengths requiring 4 bytes.
 void testSocketStuff()
           
 void write(byte[] b, int off, int len)
           
 void writeByte(int data)
           
 void writeFromStream(java.io.InputStream inStream)
          Read from the provided input stream and write the results on the socket.
 void writeInt(int data)
           
 void writeObject(java.lang.Object obj)
           
 void writeString(java.lang.String dataString)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientSocket

public ClientSocket(java.lang.String host,
                    int port)
             throws java.io.IOException

ClientSocket

public ClientSocket(java.net.InetAddress addr,
                    int port)
             throws java.io.IOException

ClientSocket

public ClientSocket(java.net.Socket sock)
             throws java.io.IOException

ClientSocket

public ClientSocket(java.net.URL url,
                    int port)
             throws java.io.IOException
Method Detail

getSocket

public java.net.Socket getSocket()
There just may be a need to get to the actual socket.


getBufferedOutputStream

public java.io.BufferedOutputStream getBufferedOutputStream()

getBufferedInputStream

public java.io.BufferedInputStream getBufferedInputStream()

close

public void close()
           throws java.io.IOException
java.io.IOException

finalize

protected void finalize()
                 throws java.io.IOException
Overrides:
finalize in class java.lang.Object
java.io.IOException

main

public static void main(java.lang.String[] args)
Methods to test client socket.


readInt

public int readInt()
            throws java.io.IOException
java.io.IOException

readObject

public java.lang.Object readObject()
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

readOntoStream

public void readOntoStream(java.io.OutputStream outStream)
                    throws java.io.IOException
Read an unknown amount of bytes from the socket and write them onto the provided output stream.

java.io.IOException

readString

public java.lang.String readString()
                            throws java.io.IOException
I could have used readUTF, but this implementation allows for lengths requiring 4 bytes.

java.io.IOException

testSocketStuff

public void testSocketStuff()

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
java.io.IOException

writeByte

public void writeByte(int data)
               throws java.io.IOException
java.io.IOException

writeFromStream

public void writeFromStream(java.io.InputStream inStream)
                     throws java.io.IOException
Read from the provided input stream and write the results on the socket.

java.io.IOException

writeInt

public void writeInt(int data)
              throws java.io.IOException
java.io.IOException

writeObject

public void writeObject(java.lang.Object obj)
                 throws java.io.IOException
java.io.IOException

writeString

public void writeString(java.lang.String dataString)
                 throws java.io.IOException
java.io.IOException