Package convex.core.data
Class ANumericBlob
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.ACountable<CVMByte>
convex.core.data.ABlob
convex.core.data.AArrayBlob
convex.core.data.ANumericBlob
- All Implemented Interfaces:
IValidated
,IWriteable
,Comparable<ABlob>
Base class for Blobs which represent an integral numeric value
-
Field Summary
Fields inherited from class convex.core.data.AArrayBlob
length, offset, store
Fields inherited from class convex.core.data.ABlob
contentHash
Fields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
encode(byte[] bs, int pos)
Writes this Cell's encoding to a byte array, including a tag byte which will be written firstboolean
Determines if this Blob is equal to another Blob.boolean
equals(ANumericBlob a)
int
Estimate the encoded data size for this Cell.getChunk(long i)
Gets a chunk of this Blob, as a canonical Blob up to the maximum chunk sizebyte
getTag()
Gets the tag byte for this cell.boolean
Returns true if this Cell is in a canonical format for message writing.boolean
Returns true if this object represents a first class CVM Value.boolean
Returns true if this object is a regular blob (i.e.Methods inherited from class convex.core.data.AArrayBlob
append, byteAt, commonHexPrefixLength, compareTo, compareTo, count, encodeRaw, equalsBytes, equalsBytes, getByteBuffer, getBytes, getHexDigit, getInternalArray, getInternalOffset, getRefCount, getUnchecked, hexMatches, hexMatchLength, longValue, rangeMatches, rangeMatches, slice, slice, toBlob, toHexString, toHexString, toLong, updateDigest, validate, validateCell, writeToBuffer, writeToBuffer
Methods inherited from class convex.core.data.ABlob
computeHash, empty, equals, get, getBytes, getContentHash, getElementRef, getType, hashCode, hexEquals, hexEquals, hexLength, print, toByteBuffer, toCanonical, toHexString
Methods inherited from class convex.core.data.ACountable
isEmpty, size
Methods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, equals, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, isEmbedded, toString, updateRefs, write
Methods inherited from class convex.core.data.AObject
attachEncoding, print
-
Constructor Details
-
ANumericBlob
protected ANumericBlob(byte[] bytes, int offset, int length)
-
-
Method Details
-
estimatedEncodingSize
public int estimatedEncodingSize()Description copied from interface:IWriteable
Estimate the encoded data size for this Cell. Used for quickly sizing buffers. Implementations should try to return a size that is likely to contain the entire object when represented in binary format, including the tag byte.- Returns:
- The estimated size for the binary representation of this object.
-
equals
Description copied from class:ABlob
Determines if this Blob is equal to another Blob. Blobs are defined to be equal if they have the same on-chain representation, i.e. if and only if all of the following are true: - Blob is of the same general type - Blobs are of the same length - All byte values are equal -
equals
-
getChunk
Description copied from class:ABlob
Gets a chunk of this Blob, as a canonical Blob up to the maximum chunk size -
isRegularBlob
public boolean isRegularBlob()Description copied from class:ABlob
Returns true if this object is a regular blob (i.e. not a special blob type like Hash or Address)- Overrides:
isRegularBlob
in classABlob
- Returns:
- True if a regular blob
-
encode
public int encode(byte[] bs, int pos)Description copied from class:ACell
Writes this Cell's encoding to a byte array, including a tag byte which will be written first- Specified by:
encode
in interfaceIWriteable
- Specified by:
encode
in classACell
- Parameters:
bs
- A byte array to which to write the encodingpos
- The offset into the byte array- Returns:
- New position after writing
-
isCanonical
public boolean isCanonical()Description copied from class:ACell
Returns true if this Cell is in a canonical format for message writing. Reading or writing a non-canonical value should be considered illegal, but non-canonical objects may be used on a temporary internal basis.- Specified by:
isCanonical
in classACell
- Returns:
- true if the object is in canonical format, false otherwise
-
isCVMValue
public final boolean isCVMValue()Description copied from class:ACell
Returns true if this object represents a first class CVM Value. Sub-structural cells that are not themselves first class values should return false. CVM values might not be in a canonical format, e.g. temporary data structures- Specified by:
isCVMValue
in classACell
- Returns:
- true if the object is a CVM Value, false otherwise
-
getTag
public byte getTag()Description copied from class:ACell
Gets the tag byte for this cell. The tag byte is always written as the first byte of the Cell's Encoding
-