Class UnsignedByte

java.lang.Object
java.lang.Number
org.apache.qpid.protonj2.types.UnsignedByte
All Implemented Interfaces:
Serializable, Comparable<UnsignedByte>

public final class UnsignedByte extends Number implements Comparable<UnsignedByte>
See Also:
  • Constructor Details

    • UnsignedByte

      public UnsignedByte(byte underlying)
  • Method Details

    • byteValue

      public byte byteValue()
      Overrides:
      byteValue in class Number
    • shortValue

      public short shortValue()
      Overrides:
      shortValue in class Number
    • intValue

      public int intValue()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(byte value)
      Compares the give byte value to this unsigned byte numerically treating the given value as unsigned.
      Parameters:
      value - the byte to compare to this unsigned byte instance.
      Returns:
      the value 0 if this == value; a value less than 0 if this < value as unsigned values; and a value greater than 0 if this > value as unsigned values
    • compareTo

      public int compareTo(UnsignedByte o)
      Specified by:
      compareTo in interface Comparable<UnsignedByte>
    • compare

      public static int compare(byte left, byte right)
      Compares two short values numerically treating the values as unsigned.
      Parameters:
      left - the left hand side short to compare
      right - the right hand side short to compare
      Returns:
      the value 0 if left == right; a value less than 0 if left < right as unsigned values; and a value greater than 0 if left > right as unsigned values
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • valueOf

      public static UnsignedByte valueOf(byte value)
      Returns an UnsignedByte instance representing the specified byte value. This method always returns a cached UnsignedByte instance for values in the range [0...255] which can save space and time over calling the constructor UnsignedByte(byte) which will always create a new instance of the UnsignedByte type.
      Parameters:
      value - The byte value to return as an UnsignedByte instance.
      Returns:
      an UnsignedByte instance representing the unsigned view of the given byte.
    • valueOf

      public static UnsignedByte valueOf(String value) throws NumberFormatException
      Returns an UnsignedByte instance representing the specified String value. This method always returns a cached UnsignedByte instance for values in the range [0...255] which can save space and time over calling the constructor UnsignedByte(byte) which will always create a new instance of the UnsignedByte type.
      Parameters:
      value - The byte value to return as an UnsignedByte instance.
      Returns:
      an UnsignedByte instance representing the unsigned view of the given byte.
      Throws:
      NumberFormatException - if the given String value given cannot be converted to a numeric value.
    • toUnsignedShort

      public static short toUnsignedShort(byte value)
      Returns a short that represents the unsigned view of the given byte value.
      Parameters:
      value - The short whose unsigned value should be converted to a long.
      Returns:
      a positive short value that represents the given byte as unsigned.
    • toUnsignedInt

      public static int toUnsignedInt(byte value)
      Returns a int that represents the unsigned view of the given byte value.
      Parameters:
      value - The int whose unsigned value should be converted to a long.
      Returns:
      a positive int value that represents the given short as unsigned.
    • toUnsignedLong

      public static long toUnsignedLong(byte value)
      Returns a long that represents the unsigned view of the given byte value.
      Parameters:
      value - The long whose unsigned value should be converted to a long.
      Returns:
      a positive long value that represents the given byte as unsigned.