public class IntegerField extends Object implements FixedField
Constructor and Description |
---|
IntegerField(int offset)
construct the IntegerField with its offset into its containing
byte array
|
IntegerField(int offset,
byte[] data)
Construct the IntegerField with its offset into its containing
byte array and initialize its value from its byte array
|
IntegerField(int offset,
int value)
construct the IntegerField with its offset into its containing
byte array and initialize its value
|
IntegerField(int offset,
int value,
byte[] data)
construct the IntegerField with its offset into its containing
byte array, initialize its value, and write the value to a byte
array
|
Modifier and Type | Method and Description |
---|---|
int |
get()
get the IntegerField's current value
|
void |
readFromBytes(byte[] data)
set the value from its offset into an array of bytes
|
void |
readFromStream(InputStream stream)
set the value from an InputStream
|
void |
set(int value)
set the IntegerField's current value
|
void |
set(int value,
byte[] data)
set the IntegerField's current value and write it to a byte
array
|
String |
toString()
return the value as a String
|
void |
writeToBytes(byte[] data)
write the value out to an array of bytes at the appropriate
offset
|
public IntegerField(int offset) throws ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayArrayIndexOutOfBoundsException
- if the offset is
negativepublic IntegerField(int offset, int value) throws ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayvalue
- the initial valueArrayIndexOutOfBoundsException
- if the offset is
negativepublic IntegerField(int offset, byte[] data) throws ArrayIndexOutOfBoundsException
offset
- of the field within its byte arraydata
- the byte array to read the value fromArrayIndexOutOfBoundsException
- if the offset is not
within the range of 0..(data.length - 1)public IntegerField(int offset, int value, byte[] data) throws ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayvalue
- the initial valuedata
- the byte array to write the value toArrayIndexOutOfBoundsException
- if the offset is
negative or too largepublic int get()
public void set(int value)
value
- to be setpublic void set(int value, byte[] data) throws ArrayIndexOutOfBoundsException
value
- to be setdata
- the byte array to write the value toArrayIndexOutOfBoundsException
- if the offset is too
largepublic void readFromBytes(byte[] data) throws ArrayIndexOutOfBoundsException
readFromBytes
in interface FixedField
data
- the byte array from which the value is to be readArrayIndexOutOfBoundsException
- if the offset is too
largepublic void readFromStream(InputStream stream) throws IOException, LittleEndian.BufferUnderrunException
readFromStream
in interface FixedField
stream
- the InputStream from which the value is to be
readLittleEndian.BufferUnderrunException
- if there is not enough data
available from the InputStreamIOException
- if an IOException is thrown from reading
the InputStreampublic void writeToBytes(byte[] data) throws ArrayIndexOutOfBoundsException
writeToBytes
in interface FixedField
data
- the array of bytes to which the value is to be
writtenArrayIndexOutOfBoundsException
- if the offset is too
largepublic String toString()
toString
in interface FixedField
toString
in class Object
Copyright © 2015 Open Microscopy Environment