representation of an integer (32-bit) field at a fixed location within a byte array @author Marc Johnson (mjohnson at apache dot org
| 31 | */ |
| 32 | |
| 33 | public class IntegerField |
| 34 | implements FixedField |
| 35 | { |
| 36 | private int _value; |
| 37 | private final int _offset; |
| 38 | |
| 39 | /** |
| 40 | * construct the IntegerField with its offset into its containing |
| 41 | * byte array |
| 42 | * |
| 43 | * @param offset of the field within its byte array |
| 44 | * |
| 45 | * @exception ArrayIndexOutOfBoundsException if the offset is |
| 46 | * negative |
| 47 | */ |
| 48 | |
| 49 | public IntegerField(final int offset) |
| 50 | throws ArrayIndexOutOfBoundsException |
| 51 | { |
| 52 | if (offset < 0) |
| 53 | { |
| 54 | throw new ArrayIndexOutOfBoundsException("negative offset"); |
| 55 | } |
| 56 | _offset = offset; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * construct the IntegerField with its offset into its containing |
| 61 | * byte array and initialize its value |
| 62 | * |
| 63 | * @param offset of the field within its byte array |
| 64 | * @param value the initial value |
| 65 | * |
| 66 | * @exception ArrayIndexOutOfBoundsException if the offset is |
| 67 | * negative |
| 68 | */ |
| 69 | |
| 70 | public IntegerField(final int offset, final int value) |
| 71 | throws ArrayIndexOutOfBoundsException |
| 72 | { |
| 73 | this(offset); |
| 74 | set(value); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Construct the IntegerField with its offset into its containing |
| 79 | * byte array and initialize its value from its byte array |
| 80 | * |
| 81 | * @param offset of the field within its byte array |
| 82 | * @param data the byte array to read the value from |
| 83 | * |
| 84 | * @exception ArrayIndexOutOfBoundsException if the offset is not |
| 85 | * within the range of 0..(data.length - 1) |
| 86 | */ |
| 87 | |
| 88 | public IntegerField(final int offset, final byte [] data) |
| 89 | throws ArrayIndexOutOfBoundsException |
| 90 | { |
nothing calls this directly
no outgoing calls
no test coverage detected