com.partnersoft.v3x.net
Class NetworkLib

java.lang.Object
  extended by com.partnersoft.v3x.net.NetworkLib

public class NetworkLib
extends java.lang.Object

Generic handy network methods.


Constructor Summary
NetworkLib()
           
 
Method Summary
static java.lang.String addressPart(java.lang.String portedAddress)
           
static java.io.InputStream attachStandardInputFilters(java.io.InputStream victim)
          Use this to attach standard network input filters, based on NetworkConfig (e.g.
static java.io.OutputStream attachStandardOutputFilters(java.io.OutputStream victim)
          Use this to attach standard network output filters, based on NetworkConfig (e.g.
static java.io.InputStream attachUncompressedInputFilters(java.io.InputStream victim)
          Use this to attach standard network input filters, based on NetworkConfig, except for compression (which often behaves strangely for interactive sessions).
static java.io.OutputStream attachUncompressedOutputFilters(java.io.OutputStream victim)
          Use this to attach standard network output filters, based on NetworkConfig, except for compression (which often behaves strangely for interactive sessions).
static java.lang.Object barsoomExchange(java.net.Socket sock, java.lang.Object argument)
          Hides the details of simple object transactions as Barsoom over a socket - you send one object, you get back another.
static java.lang.Object barsoomExchange(java.lang.String address, int port, java.lang.Object argument)
          Hides the details of simple object transactions as Barsoom over a socket - you send one object, you get back another.
static java.lang.Object exchangeObjects(java.net.Socket sock, LookupDatabase lookup, java.lang.Object argument)
          Hides the details of simple object transactions over a socket - you send one object, you get back another.
static java.lang.Object exchangeObjects(java.net.Socket sock, java.lang.Object argument)
          Hides the details of simple object transactions over a socket - you send one object, you get back another.
static java.lang.Object exchangeObjects(java.lang.String address, int port, LookupDatabase lookup, java.lang.Object argument)
          Hides the details of simple object transactions over a socket - you send one object, you get back another.
static java.lang.Object exchangeObjects(java.lang.String address, int port, java.lang.Object argument)
          Hides the details of simple object transactions over a socket - you send one object, you get back another.
static void main(java.lang.String[] argv)
           
static int portPart(java.lang.String portedAddress)
           
static void reportBytesTransferred(java.lang.String type, long count)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkLib

public NetworkLib()
Method Detail

reportBytesTransferred

public static void reportBytesTransferred(java.lang.String type,
                                          long count)

attachStandardInputFilters

public static java.io.InputStream attachStandardInputFilters(java.io.InputStream victim)
                                                      throws java.io.IOException
Use this to attach standard network input filters, based on NetworkConfig (e.g. verbose byte counters and compression). Feed it your InputStream and use the result.

Throws:
java.io.IOException

attachStandardOutputFilters

public static java.io.OutputStream attachStandardOutputFilters(java.io.OutputStream victim)
                                                        throws java.io.IOException
Use this to attach standard network output filters, based on NetworkConfig (e.g. verbose byte counters and compression). Feed it your OutputStream and use the result.

Throws:
java.io.IOException

attachUncompressedInputFilters

public static java.io.InputStream attachUncompressedInputFilters(java.io.InputStream victim)
                                                          throws java.io.IOException
Use this to attach standard network input filters, based on NetworkConfig, except for compression (which often behaves strangely for interactive sessions).

Throws:
java.io.IOException

attachUncompressedOutputFilters

public static java.io.OutputStream attachUncompressedOutputFilters(java.io.OutputStream victim)
                                                            throws java.io.IOException
Use this to attach standard network output filters, based on NetworkConfig, except for compression (which often behaves strangely for interactive sessions).

Throws:
java.io.IOException

exchangeObjects

public static java.lang.Object exchangeObjects(java.lang.String address,
                                               int port,
                                               LookupDatabase lookup,
                                               java.lang.Object argument)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Hides the details of simple object transactions over a socket - you send one object, you get back another.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

exchangeObjects

public static java.lang.Object exchangeObjects(java.net.Socket sock,
                                               LookupDatabase lookup,
                                               java.lang.Object argument)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Hides the details of simple object transactions over a socket - you send one object, you get back another. This one uses lookups.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

exchangeObjects

public static java.lang.Object exchangeObjects(java.lang.String address,
                                               int port,
                                               java.lang.Object argument)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Hides the details of simple object transactions over a socket - you send one object, you get back another.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

exchangeObjects

public static java.lang.Object exchangeObjects(java.net.Socket sock,
                                               java.lang.Object argument)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Hides the details of simple object transactions over a socket - you send one object, you get back another.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

barsoomExchange

public static java.lang.Object barsoomExchange(java.lang.String address,
                                               int port,
                                               java.lang.Object argument)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Hides the details of simple object transactions as Barsoom over a socket - you send one object, you get back another.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

barsoomExchange

public static java.lang.Object barsoomExchange(java.net.Socket sock,
                                               java.lang.Object argument)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Hides the details of simple object transactions as Barsoom over a socket - you send one object, you get back another.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

main

public static void main(java.lang.String[] argv)

addressPart

public static java.lang.String addressPart(java.lang.String portedAddress)

portPart

public static int portPart(java.lang.String portedAddress)