public class ShortField extends java.lang.Object implements FixedField
Constructor and Description |
---|
ShortField(int offset)
construct the ShortField with its offset into its containing
byte array
|
ShortField(int offset,
byte[] data)
Construct the ShortField with its offset into its containing
byte array and initialize its value from its byte array
|
ShortField(int offset,
short value)
construct the ShortField with its offset into its containing
byte array and initialize its value
|
ShortField(int offset,
short value,
byte[] data)
construct the ShortField with its offset into its containing
byte array, initialize its value, and write its value to its
byte array
|
Modifier and Type | Method and Description |
---|---|
short |
get()
get the ShortField'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(short value)
set the ShortField's current value
|
void |
set(short value,
byte[] data)
set the ShortField'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
|
public ShortField(int offset) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayjava.lang.ArrayIndexOutOfBoundsException
- if offset is negativepublic ShortField(int offset, short value) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte arrayvalue
- the initial valuejava.lang.ArrayIndexOutOfBoundsException
- if offset is negativepublic ShortField(int offset, byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
offset
- of the field within its byte arraydata
- the byte array to read the value fromjava.lang.ArrayIndexOutOfBoundsException
- if the offset is not
within the range of 0..(data.length - 1)public ShortField(int offset, short 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 tojava.lang.ArrayIndexOutOfBoundsException
- if offset is negativepublic short get()
public void set(short value)
value
- to be setpublic void set(short value, byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
value
- to be setdata
- the byte array to write the value tojava.lang.ArrayIndexOutOfBoundsException
- if the offset is out
of rangepublic void readFromBytes(byte[] data) throws java.lang.ArrayIndexOutOfBoundsException
readFromBytes
in interface FixedField
data
- the byte array from which the value is to be readjava.lang.ArrayIndexOutOfBoundsException
- if the offset is out
of rangepublic void readFromStream(java.io.InputStream stream) throws java.io.IOException
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 InputStreamjava.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
writtenjava.lang.ArrayIndexOutOfBoundsException
- if the offset is out
of rangepublic java.lang.String toString()
toString
in interface FixedField
toString
in class java.lang.Object
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.