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, valueFields inherited from class convex.core.data.ACell
cachedRef, memorySize -
Method Summary
Modifier and TypeMethodDescriptionstatic LongBlobcreate(long value) static LongBlobintencodeRaw(byte[] bs, int pos) Writes this Blob's encoding to a byte array, excluding the tag bytebooleanDetermines if this Blob is equal to another Blob.intEstimate the encoded data size for this Cell.longComputes the length of the longest common hex prefix between two blobslongReturns 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 voidupdateDigest(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, updateRefsMethods 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, validateCellMethods inherited from class convex.core.data.ABlobLike
getBytes, hexEquals, isDataValue, toHexString, toHexStringMethods inherited from class convex.core.data.ACountable
isEmptyMethods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, createEncoding, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, toCVMString, toStringMethods 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:ABlobGets a contiguous slice of this Blob, as a new Blob. Shares underlying backing data where possible -
updateDigest
- Specified by:
updateDigestin classABlob
-
hexMatch
-
equals
Description copied from class:ABlobDetermines 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:ABlobWrites this Blob's encoding to a byte array, excluding the tag byte -
estimatedEncodingSize
public int estimatedEncodingSize()Description copied from interface:IWriteableEstimate 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:ABlobLikeReturns 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:ABlobLikeConverts 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:
toFlatBlobin classALongBlob- Returns:
- A Blob instance containing the same data as this value. Might be `this` if already a flat Blob.
-