1 23 24 package com.sun.enterprise.admin.jmx.remote.comm; 25 import java.util.StringTokenizer ; 27 import java.io.Serializable ; 28 29 35 public class HostAndPort implements Serializable 36 { 37 38 public static final long serialVersionUID = 6708656762332072746L; 39 protected String mHost = null; 40 protected int mPort; 41 private boolean secure = false; 42 43 44 public HostAndPort(String host, int port, boolean secure){ 45 this.mHost = host; 46 this.mPort = port; 47 this.secure = secure; 48 } 49 50 public HostAndPort(HostAndPort rhs){ 51 this(rhs.mHost, rhs.mPort, rhs.secure); 52 } 53 54 public HostAndPort( String host, int port ) { 55 this(host, port, false); 56 } 57 58 public boolean isSecure(){ 59 return this.secure; 60 } 61 62 63 64 public String 65 getHost() 66 { 67 return( mHost ); 68 } 69 70 public int 71 getPort() 72 { 73 return( mPort ); 74 } 75 76 81 public HostAndPort( String str ) 82 { 83 StringTokenizer tokenizer = 84 new StringTokenizer ( str, ":", false); 85 86 mHost = tokenizer.nextToken(); 87 88 final String portString = tokenizer.nextToken(); 89 mPort = new Integer ( portString ).intValue(); 90 } 91 92 public String 93 toString() 94 { 95 return( mHost + ":" + mPort ); 96 } 97 } 98 | Popular Tags |