2 * jFCPlib - ARK.java - Copyright © 2008–2016 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 3 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, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.fcp;
21 * Container for ARKs (address resolution keys).
23 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
27 /** The public URI of the ARK. */
28 private final String publicURI;
30 /** The private URI of the ARK. */
31 private final String privateURI;
33 /** The number of the ARK. */
34 private final int number;
37 * Creates a new ARK with the given URI and number.
40 * The public URI of the ARK
42 * The number of the ARK
44 public ARK(String publicURI, String number) {
45 this(publicURI, null, number);
49 * Creates a new ARK with the given URIs and number.
52 * The public URI of the ARK
54 * The private URI of the ARK
56 * The number of the ARK
58 public ARK(String publicURI, String privateURI, String number) {
59 if ((publicURI == null) || (number == null)) {
60 throw new NullPointerException(((publicURI == null) ? "publicURI" : "number") + " must not be null");
62 this.publicURI = publicURI;
63 this.privateURI = privateURI;
65 this.number = Integer.valueOf(number);
66 } catch (NumberFormatException nfe1) {
67 throw new IllegalArgumentException("number must be numeric", nfe1);
72 * Returns the public URI of the ARK.
74 * @return The public URI of the ARK
76 public String getPublicURI() {
81 * Returns the private URI of the ARK.
83 * @return The private URI of the ARK
85 public String getPrivateURI() {
90 * Returns the number of the ARK.
92 * @return The number of the ARK
94 public int getNumber() {