Interface AddressParser

  • All Known Implementing Classes:
    Wallet
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface AddressParser
    Functional interface for address parsing. It takes a single parameter, but its behavior is context-specific. For example if the function was created with (getDefault(Network) it will only parse addresses for a single expected value of Network. Or, if created with getDefault() it will parse addresses matching any network. The default set of known networks is defined by BitcoinNetwork, but be aware that the Address.network() value is normalized (see Address for details.
    • Method Detail

      • parseAddress

        Address parseAddress​(java.lang.String addressString)
                      throws AddressFormatException
        Parse an address for any known/configured network
        Parameters:
        addressString - string representation of address
        Returns:
        A validated address object
        Throws:
        AddressFormatException - invalid address string
      • getDefault

        static AddressParser getDefault()
        Returns:
        The default parser for address and networks types built-in to bitcoinj.
      • getDefault

        static AddressParser getDefault​(Network network)
        Parameters:
        network - the network to parse for
        Returns:
        The default (built-in) parser for network
      • getLegacy

        @Deprecated
        static AddressParser getLegacy()
        Deprecated.
        Get a legacy address parser that knows about networks that have been dynamically added to the list maintained by Networks.
        Returns:
        A parser for all known networks
      • getLegacy

        @Deprecated
        static AddressParser getLegacy​(Network network)
        Deprecated.
        Get a legacy address parser that knows about networks that have been dynamically added to the list maintained by Networks.
        Parameters:
        network - the network to parse for
        Returns:
        A parser that will throw for strings that are not valid for network.
      • getLegacy

        @Deprecated
        static AddressParser getLegacy​(@Nullable
                                       NetworkParameters params)
        Deprecated.
        Get a legacy address parser that knows about networks that have been dynamically added to the list maintained by Networks.
        Parameters:
        params - the network to parser for, or null for all networks.
        Returns:
        A parser that will throw for strings that are not valid for network.