Package org.bitcoinj.base
Class DefaultAddressParser
- java.lang.Object
-
- org.bitcoinj.base.DefaultAddressParser
-
- All Implemented Interfaces:
AddressParser
public class DefaultAddressParser extends java.lang.Object implements AddressParser
Address parser that knows about the address types supported by bitcoinj core and is configurable with additional network types.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.bitcoinj.base.AddressParser
AddressParser.Strict
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<Network>
DEFAULT_NETWORKS_LEGACY
static java.util.List<Network>
DEFAULT_NETWORKS_SEGWIT
-
Constructor Summary
Constructors Constructor Description DefaultAddressParser()
DefaultAddressParser with default network listsDefaultAddressParser(java.util.List<Network> segwitNetworks, java.util.List<Network> base58Networks)
Use this constructor if you have a custom list of networks to use when parsing addresses
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DefaultAddressParser
fromNetworks()
Deprecated.Address
parseAddress(java.lang.String addressString, Network network)
Parse an address and validate for specified networkAddress
parseAddressAnyNetwork(java.lang.String addressString)
Parse an address that could be for any network
-
-
-
Constructor Detail
-
DefaultAddressParser
public DefaultAddressParser()
DefaultAddressParser with default network lists
-
DefaultAddressParser
public DefaultAddressParser(java.util.List<Network> segwitNetworks, java.util.List<Network> base58Networks)
Use this constructor if you have a custom list of networks to use when parsing addresses- Parameters:
segwitNetworks
- Networks to search when parsing segwit addressesbase58Networks
- Networks to search when parsing base58 addresses
-
-
Method Detail
-
fromNetworks
@Deprecated public static DefaultAddressParser fromNetworks()
Deprecated.Dynamically create a new AddressParser using a snapshot of currently configured networks from Networks.get().- Returns:
- A backward-compatible parser
-
parseAddressAnyNetwork
public Address parseAddressAnyNetwork(java.lang.String addressString) throws AddressFormatException
Description copied from interface:AddressParser
Parse an address that could be for any network- Specified by:
parseAddressAnyNetwork
in interfaceAddressParser
- Parameters:
addressString
- string representation of address- Returns:
- A validated address object
- Throws:
AddressFormatException
- invalid address string
-
parseAddress
public Address parseAddress(java.lang.String addressString, Network network) throws AddressFormatException
Description copied from interface:AddressParser
Parse an address and validate for specified network- Specified by:
parseAddress
in interfaceAddressParser
- Parameters:
addressString
- string representation of addressnetwork
- the network the address string must represent- Returns:
- A validated address object
- Throws:
AddressFormatException
- invalid address string or not valid for specified network
-
-