Package convex.core.data
Class Blobs
java.lang.Object
convex.core.data.Blobs
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ABlob
createFilled(int value, long length)
Create a Blob entirely filled with a given valuestatic <T extends ABlob>
TcreateRandom(long length)
static <T extends ABlob>
TcreateRandom(Random r, long length)
static ABlob
Creates a blob from a hex stringstatic ABlob
read(ByteBuffer bb)
Reads a Blob from a ByteBuffer.static <T extends ABlob>
TreadFromBlob(Blob source)
static ABlob
toCanonical(ABlob a)
Converts any blob to a the correct canonical Blob format
-
Field Details
-
MAX_ENCODING_LENGTH
public static final int MAX_ENCODING_LENGTH
-
-
Constructor Details
-
Blobs
public Blobs()
-
-
Method Details
-
createRandom
-
createRandom
-
toCanonical
Converts any blob to a the correct canonical Blob format- Parameters:
a
- Any Blob- Returns:
- Canonical version s a Blob or BlobTree
-
fromHex
Creates a blob from a hex string- Parameters:
a
- Hex String- Returns:
- Blob created, or null if String not valid hex
-
read
Reads a Blob from a ByteBuffer.- Parameters:
bb
- ByteBuffer starting with a blob encoding- Returns:
- Blob read from ByteBuffer
- Throws:
BadFormatException
- If format is invalid
-
readFromBlob
- Throws:
BadFormatException
-
createFilled
Create a Blob entirely filled with a given value- Parameters:
value
- Byte value to fill with (low 8 bits used)length
- Length of Blob to create- Returns:
- BlobTree filled with given value
-