2 * jSite - Node.java - Copyright © 2006–2012 David Roden
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package de.todesbaum.util.freenet.fcp2;
22 * Contains the hostname and port number of the Freenet node.
24 * @author David Roden <droden@gmail.com>
29 /** The default port of FCPv2. */
30 public static final int DEFAULT_PORT = 9481;
32 /** The hostname of the node. */
33 protected String hostname;
35 /** The port number of the node. */
39 * Creates a new node with the specified hostname and the default port
43 * The hostname of the node
46 public Node(String hostname) {
47 this(hostname, DEFAULT_PORT);
51 * Creates a new node with the specified hostname and port number.
54 * The hostname of the node
56 * The port number of the node
58 public Node(String hostname, int port) {
59 this.hostname = hostname;
64 * Returns the hostname of the node.
66 * @return The hostname of the node
68 public String getHostname() {
73 * Returns the port number of the node.
75 * @return The port number of the node
77 public int getPort() {
89 public String toString() {
90 return String.format("%s:%d", getHostname(), getPort());