@@ -72,11 +72,11 @@ private Address(NetworkParameters params, int version, byte[] hash160) throws Wr
7272 }
7373
7474 /**
75- * Construct an {@link Address} that represents the given pubkey hash. The resulting address will be a P2PKH type of
75+ * Construct a {@link Address} that represents the given pubkey hash. The resulting address will be a P2PKH type of
7676 * address.
7777 *
7878 * @param params
79- * the network this address is valid for
79+ * network this address is valid for
8080 * @param hash160
8181 * 20-byte pubkey hash
8282 * @return constructed address
@@ -86,34 +86,58 @@ public static Address fromPubKeyHash(NetworkParameters params, byte[] hash160) {
8686 }
8787
8888 /**
89- * Returns an {@link Address} that represents the public part of the given {@link ECKey}. Note that an address is
90- * derived from a hash of the public key and is not the public key itself (which is too large to be convenient).
89+ * Construct a {@link Address} that represents the public part of the given {@link ECKey}. Note that an address is
90+ * derived from a hash of the public key and is not the public key itself.
91+ *
92+ * @param params
93+ * network this address is valid for
94+ * @param key
95+ * only the public part is used
96+ * @return constructed address
9197 */
9298 public static Address fromKey (NetworkParameters params , ECKey key ) {
9399 return fromPubKeyHash (params , key .getPubKeyHash ());
94100 }
95101
96- /** Returns an Address that represents the given P2SH script hash. */
102+ /**
103+ * Construct a {@link Address} that represents the given P2SH script hash.
104+ *
105+ * @param params
106+ * network this address is valid for
107+ * @param hash160
108+ * P2SH script hash
109+ * @return constructed address
110+ */
97111 public static Address fromP2SHHash (NetworkParameters params , byte [] hash160 ) {
98112 try {
99113 return new Address (params , params .getP2SHHeader (), hash160 );
100114 } catch (WrongNetworkException e ) {
101- throw new RuntimeException (e ); // Cannot happen.
115+ throw new RuntimeException (e ); // Cannot happen.
102116 }
103117 }
104118
105- /** Returns an Address that represents the script hash extracted from the given scriptPubKey */
119+ /**
120+ * Constructs a {@link Address} that represents the script hash extracted from the given scriptPubKey.
121+ *
122+ * @param params
123+ * network this address is valid for
124+ * @param scriptPubKey
125+ * scriptPubKey
126+ * @return constructed address
127+ */
106128 public static Address fromP2SHScript (NetworkParameters params , Script scriptPubKey ) {
107129 checkArgument (ScriptPattern .isPayToScriptHash (scriptPubKey ), "Not a P2SH script" );
108130 return fromP2SHHash (params , ScriptPattern .extractHashFromPayToScriptHash (scriptPubKey ));
109131 }
110132
111133 /**
112- * Construct an address from its Base58 representation.
134+ * Construct a {@link Address} from its base58 form.
135+ *
113136 * @param params
114- * The expected NetworkParameters or null if you don't want validation.
137+ * expected network this address is valid for, or null if if the network should be derived from the
138+ * base58
115139 * @param base58
116- * The textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL".
140+ * base58-encoded textual form of the address
117141 * @throws AddressFormatException
118142 * if the given base58 doesn't parse or the checksum is invalid
119143 * @throws WrongNetworkException
@@ -173,7 +197,7 @@ public boolean isP2SHAddress() {
173197 * compatible with the current wallet. You should be able to handle a null response from this method. Note that the
174198 * parameters returned is not necessarily the same as the one the Address was created with.
175199 *
176- * @return a NetworkParameters representing the network the address is intended for.
200+ * @return network the address is valid for
177201 */
178202 public NetworkParameters getParameters () {
179203 return params ;
@@ -183,7 +207,8 @@ public NetworkParameters getParameters() {
183207 * Given an address, examines the version byte and attempts to find a matching NetworkParameters. If you aren't sure
184208 * which network the address is intended for (eg, it was provided by a user), you can use this to decide if it is
185209 * compatible with the current wallet.
186- * @return a NetworkParameters of the address
210+ *
211+ * @return network the address is valid for
187212 * @throws AddressFormatException if the string wasn't of a known version
188213 */
189214 public static NetworkParameters getParametersFromAddress (String address ) throws AddressFormatException {
@@ -205,9 +230,6 @@ private static boolean isAcceptableVersion(NetworkParameters params, int version
205230 return false ;
206231 }
207232
208- /**
209- * This implementation narrows the return type to <code>Address</code>.
210- */
211233 @ Override
212234 public Address clone () throws CloneNotSupportedException {
213235 return (Address ) super .clone ();
0 commit comments