Package convex.core.data
Class BlobBuilder
java.lang.Object
convex.core.data.BlobBuilder
Similar to Java StringBuilder designed for adding small Blobs
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(byte b)
append(char c)
Append a CVM character to this Blobvoid
void
append(ByteBuffer bb)
Appends remaining bytes from a ByteBuffer to this BlobBuilderboolean
check(long limit)
Checks if this BlobBuilder is less than or equal to the specified limitvoid
clear()
Clears this BlobBuilder, preparing for new appends to an empty Bloblong
count()
slice(long start, long length)
Takes a slice of the Blob currently under construction.toBlob()
-
Field Details
-
acc
-
tail
protected byte[] tail -
count
protected long count
-
-
Constructor Details
-
BlobBuilder
public BlobBuilder() -
BlobBuilder
-
-
Method Details
-
append
-
append
-
toBlob
-
slice
Takes a slice of the Blob currently under construction. May be more efficient than toBLob().slice(...).- Parameters:
start
- Start index of slicelength
- Length of slice- Returns:
- Slice of Blob under construction
-
getCVMString
-
count
public long count() -
append
-
append
-
append
-
append
Append a CVM character to this Blob- Parameters:
c
- CVM Character- Returns:
- This BlobBuilder
-
check
public boolean check(long limit)Checks if this BlobBuilder is less than or equal to the specified limit- Parameters:
limit
- Maximum allowable length of BlobBuilder- Returns:
- true if within limit, false if exceeded
-
append
Appends remaining bytes from a ByteBuffer to this BlobBuilder- Parameters:
bb
- ByteBuffer to append
-
clear
public void clear()Clears this BlobBuilder, preparing for new appends to an empty Blob
-