public static TCPEndpoint read(ObjectInput in) throws IOException, ClassNotFoundException {
  String host;
  int port;
  RMIClientSocketFactory csf=null;
  byte format=in.readByte();
switch (format) {
case FORMAT_HOST_PORT:
    host=in.readUTF();
  port=in.readInt();
break;
case FORMAT_HOST_PORT_FACTORY:
host=in.readUTF();
port=in.readInt();
csf=(RMIClientSocketFactory)in.readObject();
break;
default :
throw new IOException("invalid endpoint format");
}
return new TCPEndpoint(host,port,csf,null);
}

public static TCPEndpoint read ( ObjectInput in ) throws IOException , ClassNotFoundException { String host ; int port ; RMIClientSocketFactory csf = null ; byte format = in . readByte ( ) ; switch ( format ) { case FORMAT_HOST_PORT : host = in . readUTF ( ) ; port = in . readInt ( ) ; break ; case FORMAT_HOST_PORT_FACTORY : host = in . readUTF ( ) ; port = in . readInt ( ) ; csf = ( RMIClientSocketFactory ) in . readObject ( ) ; break ; default : throw new IOException ( "invalid endpoint format" ) ; } return new TCPEndpoint ( host , port , csf , null ) ; }
get the endpoint from the input stream .
