|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--webfunds.sox.Encodable
|
+--webfunds.token.Token
This class represents a token (a.k.a. coin) throughout its lifecycle. Token objects are usually created by means of a Withdrawal protocol between client and mint-capable SOXServer. They go through several phases, being potentially: proto signed blinded spent which are handled by extending classes as phases.
| Field Summary | |
protected long |
expiry
Tokens commonly come from a batch that is identified with a series label or an expiry date. |
protected byte[] |
item
The item that this token relates to. |
protected int |
log
The quantity of the item that this token represents. |
protected int |
phase
|
static int |
PHASE_BUILDER
The Phase of the Token structure: The Token Phase structure is the immediately extending one: e.g., TokenBuilder, TokenSigner, TokenSpender, TokenDead. |
static int |
PHASE_DEAD
The Phase of the Token structure: The Token Phase structure is the immediately extending one: e.g., TokenBuilder, TokenSigner, TokenSpender, TokenDead. |
static int |
PHASE_SIGNER
The Phase of the Token structure: The Token Phase structure is the immediately extending one: e.g., TokenBuilder, TokenSigner, TokenSpender, TokenDead. |
static int |
PHASE_SPEND
The Phase of the Token structure: The Token Phase structure is the immediately extending one: e.g., TokenBuilder, TokenSigner, TokenSpender, TokenDead. |
protected int |
phaseVersion
The version number for Token Phase structure is defined by the phase. |
static java.lang.String[] |
ps
|
protected byte[] |
series
|
protected int |
state
The state that the token is the state machine within the phase. |
protected int |
subversion
The version of the subclass Token that sets the type. |
static int |
TOK_ORIGINAL
The version number for Token structure: 0: current |
protected int |
type
The type of token of this class, e.g., Wagner. |
| Constructor Summary | |
Token()
Create an uninitialised token. |
|
Token(byte[] buf)
Construct a token object from a byte array that was previously returned from the encode() method of a token object. |
|
Token(java.io.InputStream is)
Construct a token object from data in an input stream, where the data was previously returned from the encode() method of a token object. |
|
| Method Summary | |
void |
decode(java.io.InputStream is)
Update this token object with the values from a token encoded as a byte array (such as previously returned from the encode() method of a token object). |
void |
encode(java.io.OutputStream os)
Encode a token as a byte array, suitable for saving state. |
boolean |
equals(java.lang.Object obj)
|
long |
getExpiry()
|
byte[] |
getItem()
|
int |
getLog()
|
int |
getPhase()
|
java.lang.String |
getPhaseString()
|
int |
getPhaseVersion()
|
long |
getQty()
Note (1) that this may be derived information, the real token value may be encoded in the signature key or some other way. |
byte[] |
getSeries()
|
int |
getState()
|
int |
getSubVersion()
|
int |
getType()
|
abstract byte[] |
getUniqueId()
Get the unique identifier that is used for checking against double-spending. |
int |
getVersion()
|
boolean |
isBuilder()
|
boolean |
isDead()
|
boolean |
isSigner()
|
boolean |
isSpender()
|
boolean |
isValidPhase()
|
void |
setState(int state)
|
java.lang.String |
toString()
|
java.lang.String |
vString()
|
| Methods inherited from class webfunds.sox.Encodable |
decode,
encode,
main,
readByteArray,
readCertificate,
readProperties,
readString,
writeByteArray,
writeCertificate,
writeProperties,
writeString |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int TOK_ORIGINAL
public static final int PHASE_BUILDER
public static final int PHASE_SIGNER
public static final int PHASE_SPEND
public static final int PHASE_DEAD
protected int phase
public static final java.lang.String[] ps
protected int phaseVersion
protected int type
protected int subversion
protected int state
protected int log
protected long expiry
protected byte[] series
protected byte[] item
| Constructor Detail |
public Token()
public Token(byte[] buf)
throws TokenPacketException
token - the previously encoded token
public Token(java.io.InputStream is)
throws TokenPacketException
is - the input stream from which to read the token data| Method Detail |
public final int getVersion()
public final int getPhase()
public java.lang.String getPhaseString()
public final boolean isValidPhase()
public final boolean isBuilder()
public final boolean isSigner()
public final boolean isSpender()
public final boolean isDead()
public final int getPhaseVersion()
public int getType()
public int getSubVersion()
public int getState()
public void setState(int state)
public int getLog()
public long getQty()
public long getExpiry()
public byte[] getSeries()
public abstract byte[] getUniqueId()
key - is the signer's public key (of the mint)public byte[] getItem()
public void decode(java.io.InputStream is)
throws java.io.IOException
token - the previously encoded token
public void encode(java.io.OutputStream os)
throws java.io.IOException
public java.lang.String toString()
public java.lang.String vString()
public boolean equals(java.lang.Object obj)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||