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,
int length)
Create a data object that does have the complete data.
|
Data(int header,
int length)
Creates an empty data object.
|
Data(Object object) |
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 static Data decodeHeader(io.netty.buffer.ByteBuf buf, SignatureFactory signatureFactory)
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,
PublicKey publicKey)
public boolean verify()
throws InvalidKeyException,
SignatureException,
IOException
public boolean verify(PublicKey publicKey) throws InvalidKeyException, SignatureException, IOException
public void encodeHeader(AlternativeCompositeByteBuf buf)
public boolean encodeBuffer(AlternativeCompositeByteBuf buf)
public void encodeDone(io.netty.buffer.ByteBuf buf)
public io.netty.buffer.ByteBuf buffer()
public Object object() throws ClassNotFoundException, IOException
ClassNotFoundExceptionIOExceptionpublic long validFromMillis()
public Data sign(KeyPair keyPair) throws InvalidKeyException, SignatureException, IOException
public Data sign(PrivateKey privateKey) throws InvalidKeyException, SignatureException, IOException
public int length()
public long expirationMillis()
public int ttlSeconds()
public Data ttlSeconds(int ttlSeconds)
public Number160 basedOn()
public SignatureFactory signatureFactory()
public Data signatureFactory(SignatureFactory signatureFactory)
public boolean isProtectedEntry()
public boolean isSigned()
public Data protectedEntry(boolean protectedEntry)
public Data setProtectedEntry()
public boolean isFlag1()
public Data flag1(boolean flag1)
public Data setFlag1()
public boolean isFlag2()
public Data flag2(boolean flag2)
public Data setFlag2()
public boolean hasPublicKey()
public Data hasPublicKey(boolean publicKeyFlag)
public Data setPublicKey()
public boolean isMeta()
public Data meta(boolean meta)
public Data setMeta()
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 SHA1Signature signature()
public Data signature(SHA1Signature signature)
public Number160 hash()
Copyright © 2014. All rights reserved.