Class Blobs

java.lang.Object
convex.core.data.Blobs

public class Blobs extends Object
  • Field Details

    • MAX_ENCODING_LENGTH

      public static final int MAX_ENCODING_LENGTH
  • Constructor Details

    • Blobs

      public Blobs()
  • Method Details

    • createRandom

      public static <T extends ABlob> T createRandom(long length)
    • createRandom

      public static <T extends ABlob> T createRandom(Random r, long length)
    • toCanonical

      public static ABlob toCanonical(ABlob a)
      Converts any blob to a the correct canonical Blob format
      Parameters:
      a - Any Blob
      Returns:
      Canonical version s a Blob or BlobTree
    • fromHex

      public static ABlob fromHex(String a)
      Creates a blob from a hex string
      Parameters:
      a - Hex String
      Returns:
      Blob created, or null if String not valid hex
    • read

      public static ABlob read(ByteBuffer bb) throws BadFormatException
      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

      public static <T extends ABlob> T readFromBlob(Blob source) throws BadFormatException
      Throws:
      BadFormatException
    • createFilled

      public static ABlob createFilled(int value, long length)
      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