Class ANumericBlob

All Implemented Interfaces:
IValidated, IWriteable, Comparable<ABlob>

public abstract class ANumericBlob extends AArrayBlob
Base class for Blobs which represent an integral numeric value
  • Constructor Details

    • ANumericBlob

      protected ANumericBlob(byte[] bytes, int offset, int length)
  • Method Details

    • estimatedEncodingSize

      public int estimatedEncodingSize()
      Description copied from interface: IWriteable
      Estimate the encoded data size for this Cell. Used for quickly sizing buffers. Implementations should try to return a size that is likely to contain the entire object when represented in binary format, including the tag byte.
      Returns:
      The estimated size for the binary representation of this object.
    • equals

      public boolean equals(ABlob a)
      Description copied from class: ABlob
      Determines if this Blob is equal to another Blob. Blobs are defined to be equal if they have the same on-chain representation, i.e. if and only if all of the following are true: - Blob is of the same general type - Blobs are of the same length - All byte values are equal
      Specified by:
      equals in class ABlob
      Parameters:
      a - Blob to compare with
      Returns:
      true if Blobs are equal, false otherwise
    • equals

      public boolean equals(ANumericBlob a)
    • getChunk

      public Blob getChunk(long i)
      Description copied from class: ABlob
      Gets a chunk of this Blob, as a canonical Blob up to the maximum chunk size. Returns empty Blob if and only if referencing the end of a Blob with fully packed chunks
      Specified by:
      getChunk in class ABlob
      Parameters:
      i - Index of chunk
      Returns:
      A Blob containing the specified chunk data.
    • isRegularBlob

      public boolean isRegularBlob()
      Description copied from class: ABlob
      Returns true if this object is a regular blob (i.e. not a special blob type like Address)
      Overrides:
      isRegularBlob in class ABlob
      Returns:
      True if a regular blob
    • encode

      public int encode(byte[] bs, int pos)
      Description copied from class: ACell
      Writes this Cell's encoding to a byte array, including a tag byte which will be written first. Cell must be canonical, or else an error may occur.
      Specified by:
      encode in interface IWriteable
      Specified by:
      encode in class ACell
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • isCanonical

      public boolean isCanonical()
      Description copied from class: ACell
      Returns true if this Cell is in a canonical representation for message writing. Non-canonical objects may be used on a temporary internal basis, they must always be converted to canonical representations for external use (e.g. Encoding).
      Specified by:
      isCanonical in class ACell
      Returns:
      true if the object is in canonical format, false otherwise
    • getTag

      public byte getTag()
      Description copied from class: ACell
      Gets the tag byte for this cell. The tag byte is always written as the first byte of the Cell's Encoding
      Specified by:
      getTag in class ACell
      Returns:
      Tag byte for this Cell