com.ibm.jzos.fields

Class BinaryAsLongField

  • java.lang.Object
    • com.ibm.jzos.fields.BinaryAsLongField
    • Constructor Detail

      • BinaryAsLongField

        public BinaryAsLongField(int offset)
        Construct a signed instance with a field width = DEFAULT_FIELD_WIDTH = 8.
        Parameters:
        offset - int the offset in some byte array to the start of this field.
      • BinaryAsLongField

        public BinaryAsLongField(int offset,
                                 int length)
        Construct a signed instance with a given offset and length.
        Parameters:
        offset - int the offset in some byte array to the start of this field.
        length - int the size of the field in bytes
      • BinaryAsLongField

        public BinaryAsLongField(int offset,
                                 int length,
                                 boolean signed)
        Construct an instance.
        Parameters:
        offset - int the offset in some byte array to the start of this field.
        length - int the size of the field in bytes
        signed - boolean true if the field is signed, false if unsigned.
    • Method Detail

      • getByteLength

        public int getByteLength()
        Answer the length of the field described by the receiver
        Specified by:
        getByteLength in interface Field
        Returns:
        int
      • getOffset

        public int getOffset()
        Answer the offset of this field into some array of bytes
        Specified by:
        getOffset in interface Field
        Returns:
        int
      • getLong

        public long getLong(byte[] buffer,
                            int bufOffset)
        Answer a long from the given byte array buffer, at the bufOffset + offset of this field.
        Specified by:
        getLong in interface LongAccessor
        Parameters:
        buffer - the byte array
        bufOffset - the additional offset into the byte array
        Returns:
        long
        Throws:
        java.lang.IllegalArgumentException - if the value in the field is unsigned and too large to be represented as a java long
      • getLong

        public long getLong(byte[] buffer)
        Answer a long from the given byte array buffer, at the offset of this field.
        Specified by:
        getLong in interface LongAccessor
        Parameters:
        buffer - the byte array
        Returns:
        long
        Throws:
        java.lang.IllegalArgumentException - if the value in the field is unsigned and too large to be represented as a java long
      • putLong

        public void putLong(long value,
                            byte[] buffer,
                            int bufOffset)
                     throws java.lang.IllegalArgumentException
        Put a signed long into thegiven byte array buffer, at the bufOffset + offset of this field.
        Specified by:
        putLong in interface LongAccessor
        Parameters:
        value - the signed long value
        buffer - the byte array
        bufOffset - the additional offset into the byte array
        Throws:
        java.lang.IllegalArgumentException - if the value is out of range
      • putLong

        public void putLong(long value,
                            byte[] buffer)
                     throws java.lang.IllegalArgumentException
        Put a signed long into thegiven byte array buffer, at the bufOffset of this field.
        Specified by:
        putLong in interface LongAccessor
        Parameters:
        value - the signed long value
        buffer - the byte array
        Throws:
        java.lang.IllegalArgumentException - if the value is out of range
      • isSigned

        public boolean isSigned()
        Answer true if this field described a signed binary int, false if unsigned.
        Specified by:
        isSigned in interface LongAccessor
      • setSigned

        public void setSigned(boolean signed)
        Deprecated. Change the sign of the field. When Data Access Acceleration (DAA) is enabled, this method is not supported and an UnsupportedOperationException will be thrown.
        See Also:
        isSigned()
      • equals

        public boolean equals(java.lang.Long aLong,
                              long along)
        Compare a Long, possibly null, with a long for equality.
        Parameters:
        aLong -
        along -
        Returns:
        boolean true if equal, false otherwise
� Copyright IBM Corporation 2005, 2022.