1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package gnu.inet.ftp;
22
23 import java.net.InetAddress;
24 import java.net.UnknownHostException;
25
26 /***
27 * This class encapsulates the parameters of a passive data connection.
28 */
29 public class PassiveParameters extends Object {
30
31 private InetAddress address;
32 private Integer port;
33
34
35
36
37
38 /***
39 * create a new instance of PassiveParameters
40 *
41 * @param address
42 * IP address
43 * @param port
44 * TCP/IP port value
45 */
46 public PassiveParameters(String address, int port)
47 throws UnknownHostException {
48 this.address = InetAddress.getByName(address);
49 this.port = new Integer(port);
50 }
51
52 /***
53 * get the port value
54 *
55 * @return port value as int
56 */
57 public int getPort() {
58 return port.intValue();
59 }
60
61 /***
62 * get the IP address
63 *
64 * @return IP address
65 */
66 public InetAddress getInetAddress() {
67 return address;
68 }
69
70 /***
71 * compare another PassiveParameters instance to this one.
72 *
73 * @param other
74 * the other instance to compare this one with
75 * @return true if the other instance equals this one, false if they are not
76 * equal
77 */
78 public boolean equals(PassiveParameters other) {
79 if ((this.port == other.port) && (this.address.equals(other.address))) {
80 return true;
81 }
82 return false;
83 }
84
85 }