|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.util.ByteField
public class ByteField
representation of a byte (8-bit) field at a fixed location within a byte array
Constructor Summary | |
---|---|
ByteField(int offset)
construct the ByteField with its offset into its containing byte array and a default value of 0 |
|
ByteField(int offset,
byte value)
construct the ByteField with its offset into its containing byte array and initialize its value |
|
ByteField(int offset,
byte[] data)
Construct the ByteField with its offset into its containing byte array and initialize its value from its byte array |
|
ByteField(int offset,
byte value,
byte[] data)
construct the ByteField with its offset into its containing byte array, initialize its value, and write its value to its byte array |
Method Summary | |
---|---|
byte |
get()
get the ByteField's current value |
void |
readFromBytes(byte[] data)
set the value from its offset into an array of bytes |
void |
readFromStream(java.io.InputStream stream)
set the value from an InputStream |
void |
set(byte value)
set the ByteField's current value |
void |
set(byte value,
byte[] data)
set the ByteField's current value and write it to a byte array |
java.lang.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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ByteField(int offset) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte array
java.lang.ArrayIndexOutOfBoundsException
- if offset is negativepublic ByteField(int offset, byte value) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayvalue
- the initial value
java.lang.ArrayIndexOutOfBoundsException
- if offset is negativepublic ByteField(int offset, byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte arraydata
- the byte array to read the value from
java.lang.ArrayIndexOutOfBoundsException
- if the offset is not
within the range of 0..(data.length - 1)public ByteField(int offset, byte value, byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayvalue
- the initial valuedata
- the byte array to write the value to
java.lang.ArrayIndexOutOfBoundsException
- if the offset is not
within the range of 0..(data.length - 1)Method Detail |
---|
public byte get()
public void set(byte value)
value
- to be setpublic void set(byte value, byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
value
- to be setdata
- the byte array to write the value to
java.lang.ArrayIndexOutOfBoundsException
- if the offset is out
of the byte array's rangepublic void readFromBytes(byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
readFromBytes
in interface FixedField
data
- the byte array from which the value is to be read
java.lang.ArrayIndexOutOfBoundsException
- if the offset is out
of range of the bte arraypublic void readFromStream(java.io.InputStream stream) throws java.io.IOException, LittleEndian.BufferUnderrunException
readFromStream
in interface FixedField
stream
- the InputStream from which the value is to be
read
LittleEndian.BufferUnderrunException
- if there is not enough data
available from the InputStream
java.io.IOException
- if an IOException is thrown from reading
the InputStreampublic void writeToBytes(byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
writeToBytes
in interface FixedField
data
- the array of bytes to which the value is to be
written
java.lang.ArrayIndexOutOfBoundsException
- if the offset is out
of the byte array's rangepublic java.lang.String toString()
toString
in interface FixedField
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |