1 20 21 22 23 package org.snmp4j.smi; 24 25 import java.net.InetAddress ; 26 import org.snmp4j.log.*; 27 28 33 34 public class TcpAddress extends TransportIpAddress { 35 36 static final long serialVersionUID = 1165319744164017388L; 37 38 private static final LogAdapter logger = LogFactory.getLogger(TcpAddress.class); 39 40 public TcpAddress() { 41 super(); 42 } 43 44 public TcpAddress(InetAddress inetAddress, int port) { 45 setInetAddress(inetAddress); 46 setPort(port); 47 } 48 49 public TcpAddress(int port) { 50 super(); 51 setPort(port); 52 } 53 54 public TcpAddress(String address) { 55 if (!parseAddress(address)) { 56 throw new IllegalArgumentException (address); 57 } 58 } 59 60 public static Address parse(String address) { 61 try { 62 TcpAddress a = new TcpAddress(); 63 if (a.parseAddress(address)) { 64 return a; 65 } 66 } 67 catch (Exception ex) { 68 logger.error(ex); 69 } 70 return null; 71 } 72 73 } 74 | Popular Tags |