Package convex.core.data.impl
Class ZeroBlob
- All Implemented Interfaces:
IValidated
,IWriteable
,Comparable<ABlobLike<?>>
Blob filled with all zeros. Useful to avoid allocating lots of empty arrays, potentially.
-
Field Summary
FieldsFields inherited from class convex.core.data.ACell
cachedRef, memorySize
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend an additional Blob to this, creating a new Blob as needed.byte
byteAtUnchecked
(long i) Gets the byte at the specified position in this data object, possibly skipping bounds checking.static ZeroBlob
create
(long count) int
getBytes
(byte[] dest, int destOffset) Copies the bytes from this instance to a given destination arraysliceImpl
(long start, long end) Constructs a slice of this Blob as the same type.Methods inherited from class convex.core.data.ADerivedBlob
encodeRaw, equals, equalsBytes, equalsBytes, estimatedEncodingSize, getByteBuffer, getChunk, getRefCount, hexMatch, isCanonical, isFullyPacked, longValue, read, slice, toCanonical, toFlatBlob, updateDigest
Methods inherited from class convex.core.data.ABlob
byteAt, compareTo, computeHash, count, empty, encode, equals, get, getContentHash, getElementRef, getTag, getType, hashCode, isChunkPacked, isCVMValue, print, read, replaceSlice, shortAt, size, slice, toBlob, toByteBuffer, validate, validateCell
Methods inherited from class convex.core.data.ABlobLike
appendHex, getBytes, getHexDigit, hexEquals, hexLength, hexMatch, isDataValue, toHexString, toHexString
Methods inherited from class convex.core.data.ACountable
isEmpty
Methods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createEncoding, createRef, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, getRef, isEmbedded, toCVMString, toString, updateRefs
Methods inherited from class convex.core.data.AObject
attachEncoding, print, print
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ZeroBlob
protected ZeroBlob(long count)
-
-
Method Details
-
append
Description copied from class:ABlob
Append an additional Blob to this, creating a new Blob as needed.- Overrides:
append
in classADerivedBlob
- Parameters:
other
- Blob to append- Returns:
- A new Blob, containing the additional data appended to this blob.
-
sliceImpl
Description copied from class:ADerivedBlob
Constructs a slice of this Blob as the same type. Assumes a new slice must be constructed and that bounds have already been checked.- Specified by:
sliceImpl
in classADerivedBlob
- Parameters:
start
- Start of sliceend
- End of slice- Returns:
- New slice instance
-
create
-
getBytes
public int getBytes(byte[] dest, int destOffset) Description copied from class:ABlobLike
Copies the bytes from this instance to a given destination array- Specified by:
getBytes
in classADerivedBlob
- Parameters:
dest
- Destination arraydestOffset
- Offset into destination array- Returns:
- End position in destination array after writing
-
byteAtUnchecked
public byte byteAtUnchecked(long i) Description copied from class:ABlobLike
Gets the byte at the specified position in this data object, possibly skipping bounds checking. Only safe if index is known to be in bounds, otherwise result is undefined.- Overrides:
byteAtUnchecked
in classABlobLike<CVMLong>
- Parameters:
i
- Index of the byte to get- Returns:
- The byte at the specified position
-