1. /*
  2. * @(#)IIOPAddressImpl.java 1.5 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.ior.iiop;
  8. import org.omg.CORBA.BAD_PARAM ;
  9. import org.omg.CORBA_2_3.portable.InputStream ;
  10. import org.omg.CORBA_2_3.portable.OutputStream ;
  11. import com.sun.corba.se.spi.orb.ORB ;
  12. import com.sun.corba.se.spi.logging.CORBALogDomains ;
  13. import com.sun.corba.se.impl.logging.IORSystemException ;
  14. /**
  15. * @author
  16. */
  17. public final class IIOPAddressImpl extends IIOPAddressBase
  18. {
  19. private ORB orb ;
  20. private IORSystemException wrapper ;
  21. private String host;
  22. private int port;
  23. public IIOPAddressImpl( ORB orb, String host, int port )
  24. {
  25. this.orb = orb ;
  26. wrapper = IORSystemException.get( orb,
  27. CORBALogDomains.OA_IOR ) ;
  28. if ((port < 0) || (port > 65535))
  29. throw wrapper.badIiopAddressPort( new Integer(port)) ;
  30. this.host = host ;
  31. this.port = port ;
  32. }
  33. public IIOPAddressImpl( InputStream is )
  34. {
  35. host = is.read_string() ;
  36. short thePort = is.read_short() ;
  37. port = shortToInt( thePort ) ;
  38. }
  39. public String getHost()
  40. {
  41. return host ;
  42. }
  43. public int getPort()
  44. {
  45. return port ;
  46. }
  47. }