public class Data extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Data.Type
small means 8 bit, medium is 32bit.
|
| Constructor and Description |
|---|
Data() |
Data(byte[] buffer) |
Data(byte[] buffer,
int offest,
int length)
Creates a data object from an already existing byte buffer.
|
Data(DataBuffer buffer) |
Data(DataBuffer buffer,
int length)
Create a data object that does have the complete data, but not the complete header
|
Data(int header,
int length)
Creates an empty data object.
|
Data(Object object) |
| Modifier and Type | Method and Description |
|---|---|
Data |
addBasedOn(Number160 basedOn) |
Collection<Number160> |
basedOnSet() |
io.netty.buffer.ByteBuf |
buffer() |
boolean |
decodeBuffer(io.netty.buffer.ByteBuf buf)
Add data to the byte buffer.
|
boolean |
decodeDone(io.netty.buffer.ByteBuf buf,
PublicKey publicKey,
SignatureFactory signatureFactory) |
boolean |
decodeDone(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory) |
static Data |
decodeHeader(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory)
Reads the header.
|
Data |
deleted() |
Data |
deleted(boolean deleted) |
Data |
duplicate() |
Data |
duplicateMeta() |
boolean |
encodeBuffer(AlternativeCompositeByteBuf buf) |
void |
encodeDone(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory) |
void |
encodeDone(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory,
PrivateKey messagePrivateKey) |
void |
encodeHeader(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory)
* Header format:
|
boolean |
equals(Object obj) |
long |
expirationMillis() |
Data |
flag1() |
Data |
flag1(boolean flag1) |
Data |
flag2() |
Data |
flag2(boolean flag2) |
Number160 |
hash() |
int |
hashCode() |
boolean |
hasPrepareFlag() |
boolean |
hasPublicKey() |
boolean |
isDeleted() |
boolean |
isEmpty() |
boolean |
isFlag1() |
boolean |
isFlag2() |
boolean |
isMeta() |
boolean |
isProtectedEntry() |
boolean |
isSigned() |
int |
length() |
Data |
meta() |
Data |
meta(boolean meta) |
Object |
object() |
Data |
prepareFlag() |
Data |
prepareFlag(boolean prepareFlag) |
PrivateKey |
privateKey() |
Data |
protectEntry() |
Data |
protectEntry(KeyPair keyPair) |
Data |
protectEntry(PrivateKey privateKey) |
Data |
protectEntryNow(KeyPair keyPair,
SignatureFactory signatureFactory) |
Data |
protectEntryNow(PrivateKey privateKey,
SignatureFactory signatureFactory) |
PublicKey |
publicKey() |
Data |
publicKey(PublicKey publicKey) |
Data |
publicKeyFlag() |
Data |
publicKeyFlag(boolean publicKeyFlag) |
void |
resetAlreadyTransferred() |
Data |
sign() |
Data |
sign(KeyPair keyPair) |
Data |
sign(PrivateKey privateKey) |
SignatureCodec |
signature() |
Data |
signature(SignatureCodec signature) |
SignatureFactory |
signatureFactory() |
Data |
signatureFactory(SignatureFactory signatureFactory) |
Data |
signed() |
Data |
signed(boolean signed) |
Data |
signNow(KeyPair keyPair,
SignatureFactory signatureFactory) |
Data |
signNow(PrivateKey privateKey,
SignatureFactory signatureFactory) |
ByteBuffer[] |
toByteBuffers() |
byte[] |
toBytes() |
String |
toString() |
int |
ttlSeconds() |
Data |
ttlSeconds(int ttlSeconds) |
static Data.Type |
type(int header) |
long |
validFromMillis() |
Data |
validFromMillis(long validFromMillis) |
boolean |
verify(PublicKey publicKey,
SignatureFactory signatureFactory) |
boolean |
verify(SignatureFactory signatureFactory) |
public Data(DataBuffer buffer)
public Data(DataBuffer buffer, int length)
length - The expected length of the buffer. This does not include the
header + size (2, 5, or 9).version - The version of a data object, optionalttlSeconds - The TTL of a data object, optionalhasHash - Indication if a hash should also be transmittedisProtectedEntry - True if this entry is protectedpublic Data(int header,
int length)
#append(ByteBuf).header - The 8 bit headerlength - The length, which depends on the header valuespublic Data(Object object) throws IOException
IOExceptionpublic Data(byte[] buffer)
public Data()
public Data(byte[] buffer,
int offest,
int length)
buffer - The data bufferversion - The version of a data object, optionalttlSeconds - The ttl of a data object, optionalhasHash - Indication if a hash should also be transmittedisProtectedEntry - True if this entry is protectedpublic boolean isEmpty()
public static Data decodeHeader(io.netty.buffer.ByteBuf buf, SignatureFactory signatureFactory)
1 byte - header 1 or 4 bytes - length 4 or 0 bytes - ttl (hasTTL) 1 or 0 bytes - number of basedon keys (hasBasedOn) n x 20 bytes - basedon keys (hasBasedOn, number of basedon keys) 2 or 0 bytes - length of public key (hasPublicKey) n bytes - public key (hasPublicKey, length of public key)
buf - The buffer to read frompublic boolean decodeBuffer(io.netty.buffer.ByteBuf buf)
buf - The byte buffer to appendpublic boolean decodeDone(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory)
public boolean decodeDone(io.netty.buffer.ByteBuf buf,
PublicKey publicKey,
SignatureFactory signatureFactory)
public boolean verify(SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException
public boolean verify(PublicKey publicKey, SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException
public void encodeHeader(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory)
1 byte - header 1 or 4 bytes - length 4 or 0 bytes - ttl (hasTTL) 1 or 0 bytes - number of basedon keys (hasBasedOn) n x 20 bytes - basedon keys (hasBasedOn, number of basedon keys) 2 or 0 bytes - length of public key (hasPublicKey) n bytes - public key (hasPublicKey, length of public key)
buf - signatureFactory - public boolean encodeBuffer(AlternativeCompositeByteBuf buf)
public void encodeDone(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory)
throws InvalidKeyException,
SignatureException,
IOException
public void encodeDone(io.netty.buffer.ByteBuf buf,
SignatureFactory signatureFactory,
PrivateKey messagePrivateKey)
throws InvalidKeyException,
SignatureException,
IOException
public io.netty.buffer.ByteBuf buffer()
public Object object() throws ClassNotFoundException, IOException
ClassNotFoundExceptionIOExceptionpublic long validFromMillis()
public Data validFromMillis(long validFromMillis)
public Data signNow(KeyPair keyPair, SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException
public Data protectEntryNow(KeyPair keyPair, SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException
public Data signNow(PrivateKey privateKey, SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException
public Data protectEntryNow(PrivateKey privateKey, SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException
public Data sign()
public Data sign(PrivateKey privateKey)
public Data protectEntry()
public Data protectEntry(PrivateKey privateKey)
public int length()
public long expirationMillis()
public int ttlSeconds()
public Data ttlSeconds(int ttlSeconds)
public Collection<Number160> basedOnSet()
public SignatureFactory signatureFactory()
public Data signatureFactory(SignatureFactory signatureFactory)
public boolean isProtectedEntry()
public boolean isSigned()
public Data signed(boolean signed)
public Data signed()
public boolean isFlag1()
public Data flag1(boolean flag1)
public Data flag1()
public boolean isFlag2()
public Data flag2(boolean flag2)
public Data flag2()
public boolean hasPrepareFlag()
public Data prepareFlag(boolean prepareFlag)
public Data prepareFlag()
public Data deleted()
public Data deleted(boolean deleted)
public boolean isDeleted()
public boolean hasPublicKey()
public Data publicKeyFlag(boolean publicKeyFlag)
public Data publicKeyFlag()
public boolean isMeta()
public Data meta(boolean meta)
public Data meta()
public void resetAlreadyTransferred()
public Data duplicate()
public Data duplicateMeta()
public static Data.Type type(int header)
public byte[] toBytes()
public ByteBuffer[] toByteBuffers()
public PublicKey publicKey()
public PrivateKey privateKey()
public SignatureCodec signature()
public Data signature(SignatureCodec signature)
public Number160 hash()
Copyright © 2014. All rights reserved.