|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.uri.BitcoinURI
public class BitcoinURI
Provides a standard implementation of a Bitcoin URI with support for the following:
The following input forms are accepted:
bitcoin:<address>bitcoin:<address>?<name1>=<value1>&<name2>=<value2> with multiple
additional name/value pairsThe name/value pairs are processed as follows.
req- are treated as required and if unknown or conflicting cause a parse exceptionreq- are added to a Map, accessible by parameter namereq- are processed unless they are malformedThe following names are known and have the following formats:
amount decimal value to 8 dp (e.g. 0.12345678) Note that the
exponent notation is not supported any morelabel any URL encoded alphanumericmessage any URL encoded alphanumeric
| Field Summary | |
|---|---|
static String |
BITCOIN_SCHEME
|
static String |
FIELD_ADDRESS
|
static String |
FIELD_AMOUNT
|
static String |
FIELD_LABEL
|
static String |
FIELD_MESSAGE
|
static String |
FIELD_PAYMENT_REQUEST_URL
|
| Constructor Summary | |
|---|---|
BitcoinURI(NetworkParameters params,
String input)
Constructs a new object by trying to parse the input as a valid Bitcoin URI. |
|
BitcoinURI(String uri)
Constructs a new BitcoinURI from the given string. |
|
| Method Summary | |
|---|---|
static String |
convertToBitcoinURI(Address address,
BigInteger amount,
String label,
String message)
|
static String |
convertToBitcoinURI(String address,
BigInteger amount,
String label,
String message)
Simple Bitcoin URI builder using known good fields. |
Address |
getAddress()
The Bitcoin Address from the URI, if one was present. |
BigInteger |
getAmount()
|
String |
getLabel()
|
String |
getMessage()
|
Object |
getParameterByName(String name)
|
String |
getPaymentRequestUrl()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String FIELD_MESSAGE
public static final String FIELD_LABEL
public static final String FIELD_AMOUNT
public static final String FIELD_ADDRESS
public static final String FIELD_PAYMENT_REQUEST_URL
public static final String BITCOIN_SCHEME
| Constructor Detail |
|---|
public BitcoinURI(String uri)
throws BitcoinURIParseException
uri - The raw URI data to be parsed (see class comments for accepted formats)
BitcoinURIParseException - if the URI is not syntactically or semantically valid.
public BitcoinURI(@Nullable
NetworkParameters params,
String input)
throws BitcoinURIParseException
params - The network parameters that determine which network the URI is from, or null if you don't have
any expectation about what network the URI is for and wish to check yourself.input - The raw URI data to be parsed (see class comments for accepted formats)
BitcoinURIParseException - If the input fails Bitcoin URI syntax and semantic checks.| Method Detail |
|---|
@Nullable public Address getAddress()
public BigInteger getAmount()
public String getLabel()
public String getMessage()
public String getPaymentRequestUrl()
public Object getParameterByName(String name)
name - The name of the parameter
public String toString()
toString in class Object
public static String convertToBitcoinURI(Address address,
BigInteger amount,
String label,
String message)
public static String convertToBitcoinURI(String address,
@Nullable
BigInteger amount,
@Nullable
String label,
@Nullable
String message)
address - The Bitcoin addressamount - The amount in nanocoins (decimal)label - A labelmessage - A message
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||