Top Description Fields Constructors Methods
org.apache.poi.util

public Class ByteField

extends Object
implements FixedField
Class Inheritance
All Implemented Interfaces
org.apache.poi.util.FixedField
Imports
org.apache.poi.util.LittleEndian.BufferUnderrunException, java.io.*, java.nio.BufferUnderflowException

representation of a byte (8-bit) field at a fixed location within a byte array

Field Summary

Modifier and TypeField and Description
private static final byte
private final int
private byte

Constructor Summary

AccessConstructor and Description
public
ByteField(final int
of the field within its byte array
offset
)

construct the ByteField with its offset into its containing byte array and a default value of 0

public
ByteField(final int
of the field within its byte array
offset
,
final byte
the initial value
value
)

construct the ByteField with its offset into its containing byte array and initialize its value

public
ByteField(final int
of the field within its byte array
offset
,
final byte[]
the byte array to read the value from
data
)

Construct the ByteField with its offset into its containing byte array and initialize its value from its byte array

public
ByteField(final int
of the field within its byte array
offset
,
final byte
the initial value
value
,
final byte[]
the byte array to write the value to
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

Modifier and TypeMethod and Description
public byte

Returns:

current value
get
()

get the ByteField's current value

public void
readFromBytes(final byte[]
the byte array from which the value is to be read
data
)

Implements org.apache.poi.util.FixedField.readFromBytes.

set the value from its offset into an array of bytes

public void
readFromStream(final InputStream
the InputStream from which the value is to be read
stream
)

Implements org.apache.poi.util.FixedField.readFromStream.

set the value from an InputStream

public void
set(final byte
to be set
value
)

set the ByteField's current value

public void
set(final byte
to be set
value
,
final byte[]
the byte array to write the value to
data
)

set the ByteField's current value and write it to a byte array

public String

Returns:

the value as a String
toString
()

Overrides java.lang.Object.toString.

Implements org.apache.poi.util.FixedField.toString.

return the value as a String

public void
writeToBytes(final byte[]
the array of bytes to which the value is to be written
data
)

Implements org.apache.poi.util.FixedField.writeToBytes.

write the value out to an array of bytes at the appropriate offset

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_default_valueback to summary
private static final byte _default_value
_offsetback to summary
private final int _offset
_valueback to summary
private byte _value

Constructor Detail

ByteFieldback to summary
public ByteField(final int offset) throws ArrayIndexOutOfBoundsException

construct the ByteField with its offset into its containing byte array and a default value of 0

Parameters
offset:int

of the field within its byte array

Exceptions
ArrayIndexOutOfBoundsException:
if offset is negative
ByteFieldback to summary
public ByteField(final int offset, final byte value) throws ArrayIndexOutOfBoundsException

construct the ByteField with its offset into its containing byte array and initialize its value

Parameters
offset:int

of the field within its byte array

value:byte

the initial value

Exceptions
ArrayIndexOutOfBoundsException:
if offset is negative
ByteFieldback to summary
public ByteField(final int offset, final byte[] data) throws ArrayIndexOutOfBoundsException

Construct the ByteField with its offset into its containing byte array and initialize its value from its byte array

Parameters
offset:int

of the field within its byte array

data:byte[]

the byte array to read the value from

Exceptions
ArrayIndexOutOfBoundsException:
if the offset is not within the range of 0..(data.length - 1)
ByteFieldback to summary
public ByteField(final int offset, final byte value, final byte[] data) throws ArrayIndexOutOfBoundsException

construct the ByteField with its offset into its containing byte array, initialize its value, and write its value to its byte array

Parameters
offset:int

of the field within its byte array

value:byte

the initial value

data:byte[]

the byte array to write the value to

Exceptions
ArrayIndexOutOfBoundsException:
if the offset is not within the range of 0..(data.length - 1)

Method Detail

getback to summary
public byte get()

get the ByteField's current value

Returns:byte

current value

readFromBytesback to summary
public void readFromBytes(final byte[] data) throws ArrayIndexOutOfBoundsException

Implements org.apache.poi.util.FixedField.readFromBytes.

set the value from its offset into an array of bytes

Parameters
data:byte[]

the byte array from which the value is to be read

Exceptions
ArrayIndexOutOfBoundsException:
if the offset is out of range of the bte array
readFromStreamback to summary
public void readFromStream(final InputStream stream) throws IOException

Implements org.apache.poi.util.FixedField.readFromStream.

set the value from an InputStream

Parameters
stream:InputStream

the InputStream from which the value is to be read

Exceptions
IOException:
if an IOException is thrown from reading the InputStream
BufferUnderrunException:
if there is not enough data available from the InputStream
setback to summary
public void set(final byte value)

set the ByteField's current value

Parameters
value:byte

to be set

setback to summary
public void set(final byte value, final byte[] data) throws ArrayIndexOutOfBoundsException

set the ByteField's current value and write it to a byte array

Parameters
value:byte

to be set

data:byte[]

the byte array to write the value to

Exceptions
ArrayIndexOutOfBoundsException:
if the offset is out of the byte array's range
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements org.apache.poi.util.FixedField.toString.

return the value as a String

Returns:String

the value as a String

writeToBytesback to summary
public void writeToBytes(final byte[] data) throws ArrayIndexOutOfBoundsException

Implements org.apache.poi.util.FixedField.writeToBytes.

write the value out to an array of bytes at the appropriate offset

Parameters
data:byte[]

the array of bytes to which the value is to be written

Exceptions
ArrayIndexOutOfBoundsException:
if the offset is out of the byte array's range