Class XdrInteger

All Implemented Interfaces:
XdrType

public class XdrInteger extends XdrSimple<Integer>
Xdr Integer type from RFC 4506 An XDR signed integer is a 32-bit datum that encodes an integer in the range [-2147483648,2147483647]. The integer is represented in two's complement notation. The most and least significant bytes are0 and 3, respectively. Integers are declared as follows: int identifier; (MSB) (LSB) +-------+-------+-------+-------+ |byte 0 |byte 1 |byte 2 |byte 3 | +-------+-------+-------+-------+ |------------32 bits------------|
  • Constructor Details

    • XdrInteger

      public XdrInteger()
    • XdrInteger

      public XdrInteger(Integer value)
  • Method Details

    • encodingBodyLength

      protected int encodingBodyLength()
      The length of a signed integer is 4.
      Overrides:
      encodingBodyLength in class XdrSimple<Integer>
      Returns:
      Length of a signed integer type.
    • toBytes

      protected void toBytes()
      Encode Integer type to bytes. Cannot only use toByteArray() because of fixed 4 bytes length.
      Specified by:
      toBytes in class XdrSimple<Integer>
    • toValue

      protected void toValue()
      Decode bytes to Integer value.
      Specified by:
      toValue in class XdrSimple<Integer>