public abstract class BaseStructureHeader extends java.lang.Object implements java.lang.Cloneable, IEvioWriter
BaseStructure
). It does not contain the raw data, just the
header. The three headers for the actual structures found in evio (BANK, SEGMENT, and TAGSEMENT) all extend this.Modifier and Type | Field and Description |
---|---|
protected DataType |
dataType
The data type of the structure.
|
protected int |
length
The length of the structure in ints.
|
protected int |
number
The number represents an unsigned byte.
|
protected int |
padding
The amount of padding bytes when storing short or byte data.
|
protected int |
tag
The structure tag.
|
Constructor and Description |
---|
BaseStructureHeader()
Null constructor.
|
BaseStructureHeader(int tag,
DataType dataType)
Constructor
|
BaseStructureHeader(int tag,
DataType dataType,
int num)
Constructor
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue(java.lang.Integer integer)
Convenience method to return the byte value of an integer.
|
java.lang.Object |
clone()
Clone this object by passing responsibility to the Object class
which creates a bitwise copy which is fine since all fields are
ints or enums.
|
DataType |
getDataType()
Returns the data type for data stored in this structure as a
DataType enum. |
java.lang.String |
getDataTypeName()
Returns the data type as a string.
|
int |
getDataTypeValue()
Get the data type for the structure.
|
abstract int |
getHeaderLength()
Get the length of the structure's header in ints.
|
int |
getLength()
Get the length of the structure in ints, not counting the length word.
|
int |
getNumber()
Get the number.
|
int |
getPadding()
Get the amount of padding bytes when storing short or byte data.
|
int |
getTag()
Get the structure tag.
|
void |
setDataType(DataType dataType)
Set the numeric data type for the structure.
|
(package private) void |
setDataType(int dataType)
Set the numeric data type for the structure.
|
void |
setLength(int length)
Set the length of the structure in ints, not counting the length word.
|
void |
setNumber(int number)
Set the number.
|
protected void |
setPadding(int padding)
Set the amount of padding bytes when storing short or byte data.
|
void |
setTag(int tag)
Set the structure tag.
|
short |
shortValue(java.lang.Integer integer)
Convenience method to return the short value of an integer.
|
protected abstract void |
toArray(byte[] bArray,
int offset,
java.nio.ByteOrder order)
Write myself out as a byte array of evio format data
into the given byte array in the specified byte order.
|
java.lang.String |
toString()
Obtain a string representation of the structure header.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
write
protected int length
protected int tag
protected DataType dataType
protected int padding
protected int number
public BaseStructureHeader()
public BaseStructureHeader(int tag, DataType dataType)
tag
- the tag for the header.dataType
- the enum data type for the content of the structure.public BaseStructureHeader(int tag, DataType dataType, int num)
tag
- the tag for the header.dataType
- the data type for the content of the structure.num
- sometimes, but not necessarily, an ordinal enumeration.public java.lang.Object clone()
clone
in class java.lang.Object
public int getNumber()
public void setNumber(int number)
number
- the number.public int getDataTypeValue()
void setDataType(int dataType)
dataType
- the dataTtype for the structure.public void setDataType(DataType dataType)
dataType
- the dataTtype for the structure.public DataType getDataType()
DataType
enum.DataType
enum.DataType
public java.lang.String getDataTypeName()
public int getPadding()
protected void setPadding(int padding)
padding
- amount of padding bytes when storing short or byte data (0-3).public int getLength()
public void setLength(int length)
length
- the length of the structure in ints, not counting the length word.public abstract int getHeaderLength()
protected abstract void toArray(byte[] bArray, int offset, java.nio.ByteOrder order)
bArray
- array into which evio data is written (destination).offset
- offset into bArray at which to write.order
- byte order in which to write the data.public int getTag()
public void setTag(int tag)
tag
- the structure tag.public java.lang.String toString()
toString
in class java.lang.Object
public byte byteValue(java.lang.Integer integer)
integer
- the integer whose byte value is needed. Can pass in a primitive int.public short shortValue(java.lang.Integer integer)
integer
- the integer whose short value is needed. Can pass in a primitive int.