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 first.boolean
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 size.byte
getTag()
Gets the tag byte for this cell.boolean
Returns true if this Cell is in a canonical representation for message writing.boolean
Returns true if this object is a regular blob (i.e.Methods inherited from class convex.core.data.AArrayBlob
append, appendHex, appendSmall, byteAt, commonHexPrefixLength, compareTo, compareTo, count, encodeRaw, encodeRawData, equalsBytes, equalsBytes, getByteBuffer, getBytes, getHexDigit, getInternalArray, getInternalOffset, getRefCount, getUnchecked, hexMatches, hexMatchLength, longValue, rangeMatches, rangeMatches, slice, toFlatBlob, 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, isCVMValue, print, slice, toByteBuffer, toCanonical, toHexString, 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, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, isCompletelyEncoded, isEmbedded, mark, mark, toCVMString, toString, updateRefs, write
Methods inherited from class convex.core.data.AObject
attachEncoding, print, 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- Overrides:
equals
in classAArrayBlob
- Parameters:
a
- Blob to compare with- Returns:
- true if Blobs are equal, false otherwise
-
equals
-
getChunk
Description copied from class:ABlob
Gets a chunk of this Blob, as a canonical Blob up to the maximum chunk size. Returns empty Blob if and only if referencing the end of a Blob with fully packed chunks -
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 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. Cell must be canonical, or else an error may occur.- 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 representation for message writing. Non-canonical objects may be used on a temporary internal basis, they must always be converted to canonical representations for external use (e.g. Encoding).- Specified by:
isCanonical
in classACell
- Returns:
- true if the object is in canonical format, 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
-