Class 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.
    • Field Detail

      • DEFAULT_NETWORKS_SEGWIT

        public static final java.util.List<Network> DEFAULT_NETWORKS_SEGWIT
      • DEFAULT_NETWORKS_LEGACY

        public static final java.util.List<Network> DEFAULT_NETWORKS_LEGACY
    • 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 addresses
        base58Networks - 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
      • 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 interface AddressParser
        Parameters:
        addressString - string representation of address
        network - the network the address string must represent
        Returns:
        A validated address object
        Throws:
        AddressFormatException - invalid address string or not valid for specified network