Package convex.core.data
Class LongBlob
- All Implemented Interfaces:
IValidated
,IWriteable
,Comparable<ABlobLike<?>>
Wrapper for an 8-byte long as a Blob
We use this mainly for efficient management of indexes using Longs in Indexes.
-
Field Summary
FieldsFields inherited from class convex.core.data.ALongBlob
HEX_LENGTH, LENGTH, value
Fields inherited from class convex.core.data.ACell
cachedRef, memorySize
-
Method Summary
Modifier and TypeMethodDescriptionstatic LongBlob
create
(long value) static LongBlob
int
encodeRaw
(byte[] bs, int pos) Writes this Blob's encoding to a byte array, excluding the tag byteboolean
Determines if this Blob is equal to another Blob.int
Estimate the encoded data size for this Cell.long
Computes the length of the longest common hex prefix between two blobslong
Returns the number of matching hex digits in the given hex range of another Blob.slice
(long start, long end) Gets a contiguous slice of this Blob, as a new Blob.Converts the contents of this value to a flat array-backed Blob instance.protected void
updateDigest
(MessageDigest digest) Methods inherited from class convex.core.data.ALongBlob
append, appendHex, byteAt, byteAtUnchecked, calcMemorySize, compareTo, compareTo, createRef, equalsBytes, equalsBytes, getByteBuffer, getBytes, getChunk, getHexDigit, getRef, getRefCount, hexLength, isCanonical, isChunkPacked, isEmbedded, isFullyPacked, longValue, read, toCanonical, updateRefs
Methods inherited from class convex.core.data.ABlob
computeHash, count, empty, encode, equals, get, getContentHash, getElementRef, getTag, getType, hashCode, isCVMValue, print, read, replaceSlice, shortAt, size, slice, toBlob, toByteBuffer, validate, validateCell
Methods inherited from class convex.core.data.ABlobLike
getBytes, hexEquals, isDataValue, toHexString, toHexString
Methods inherited from class convex.core.data.ACountable
isEmpty
Methods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, createEncoding, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, toCVMString, toString
Methods inherited from class convex.core.data.AObject
attachEncoding, print, print
-
Field Details
-
MAX_ENCODING_LENGTH
public static final int MAX_ENCODING_LENGTH- See Also:
-
ZERO
-
-
Method Details
-
create
-
create
-
slice
Description copied from class:ABlob
Gets a contiguous slice of this Blob, as a new Blob. Shares underlying backing data where possible -
updateDigest
- Specified by:
updateDigest
in classABlob
-
hexMatch
-
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 encoded representation, i.e. if and only if all of the following are true: - Blobs are of the same length - All byte values are equal -
encodeRaw
public int encodeRaw(byte[] bs, int pos) Description copied from class:ABlob
Writes this Blob's encoding to a byte array, excluding the tag byte -
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 highly likely to contain the entire object when encoded, including the tag byte. Should not traverse soft Refs, i.e. must be usable on arbitrary partial data structures- Returns:
- The estimated size for the binary representation of this object.
-
hexMatch
Description copied from class:ABlobLike
Returns the number of matching hex digits in the given hex range of another Blob. Assumes range is valid for both blobs. Returns length if this Blob is exactly equal to the specified hex range. -
toFlatBlob
Description copied from class:ABlobLike
Converts the contents of this value to a flat array-backed Blob instance. Warning: might be O(n) in size of Blob, may not be canonical etc.- Specified by:
toFlatBlob
in classALongBlob
- Returns:
- A Blob instance containing the same data as this value. Might be `this` if already a flat Blob.
-