com.ibm.jzos.fields
Class BinaryAsLongField

java.lang.Object
  extended by com.ibm.jzos.fields.BinaryAsLongField
All Implemented Interfaces:
Field, LongAccessor

public class BinaryAsLongField
extends java.lang.Object
implements LongAccessor

A 4-8 byte binary Field with long accessors.


Constructor Summary
BinaryAsLongField(int offset, int length, boolean signed)
          Construct an instance.
 
Method Summary
 boolean equals(java.lang.Long aLong, long along)
          Compare a Long, possibly null, with a long for equality.
 int getByteLength()
          Answer the length of the field described by the receiver
 long getLong(byte[] buffer)
          Answer a long from the given byte array buffer, at the offset of this field.
 long getLong(byte[] buffer, int bufOffset)
          Answer a long from the given byte array buffer, at the bufOffset + offset of this field.
 int getOffset()
          Answer the offset of this field into some array of bytes
 boolean isSigned()
          Answer true if this field described a signed binary int, false if unsigned.
 void putLong(long value, byte[] buffer)
          Put a signed long into thegiven byte array buffer, at the bufOffset of this field.
 void putLong(long value, byte[] buffer, int bufOffset)
          Put a signed long into thegiven byte array buffer, at the bufOffset + offset of this field.
 void setOffset(int offset)
           
 void setSigned(boolean signed)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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

setOffset

public void setOffset(int offset)
Specified by:
setOffset in interface Field
See Also:
getOffset()

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

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

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)
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