Package adams.data.io.input.opus
Class OpusBlockHelper.Block
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.data.io.input.opus.OpusBlockHelper.Block
-
- All Implemented Interfaces:
adams.core.logging.LoggingSupporter,adams.core.SizeOfHandler,Serializable
- Enclosing class:
- OpusBlockHelper
public static class OpusBlockHelper.Block extends adams.core.logging.LoggingObjectConvenience class for handling blocks.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]m_Bufferthe content of the file.protected intm_Definitionthe definition the block is based on.protected intm_Endthe end of the block (incl).protected Stringm_Namethe name of the block.protected intm_Startthe start of the block (incl).protected intm_Typethe type of the block.
-
Constructor Summary
Constructors Constructor Description Block(byte[] buffer, int def, int start, int end, int type)Initializes the block.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindID(byte[] id)Returns the offset of the ID.byte[]getBufferSection()Returns the sub-section of the buffer (copy operation!).BytegetByte(byte[] id, int offset)Returns the long with the given ID.BytegetByte(int offset)Returns the byte at the specified offset.intgetDefinition()Returns the definition that the block is based on.DoublegetDouble(byte[] id, int offset)Returns the double with the given ID.DoublegetDouble(int offset)Returns the double at the specified offset.intgetEnd()Returns the end of the block.LonggetLong(byte[] id, int offset)Returns the long with the given ID.LonggetLong(int offset)Returns the long at the specified offset.StringgetName()Returns the name of the block.intgetStart()Returns the start of the block.StringgetText(byte[] id, int offset)Returns the text with the given ID.StringgetText(int offset)Returns the text at the specified offset.intgetType()Returns the type of the block.booleanhasID(byte[] id)Returns whether the ID is present in the block.intsize()Returns the size of the block.StringtoString()Returns a short description of the block.
-
-
-
Field Detail
-
m_Buffer
protected byte[] m_Buffer
the content of the file.
-
m_Definition
protected int m_Definition
the definition the block is based on.
-
m_Start
protected int m_Start
the start of the block (incl).
-
m_End
protected int m_End
the end of the block (incl).
-
m_Type
protected int m_Type
the type of the block.
-
m_Name
protected String m_Name
the name of the block.
-
-
Method Detail
-
getDefinition
public int getDefinition()
Returns the definition that the block is based on.- Returns:
- the definition
-
getStart
public int getStart()
Returns the start of the block.- Returns:
- the start
-
getEnd
public int getEnd()
Returns the end of the block.- Returns:
- the end
-
getType
public int getType()
Returns the type of the block.- Returns:
- the type
-
getName
public String getName()
Returns the name of the block.- Returns:
- the name, null if no valid name
-
size
public int size()
Returns the size of the block.- Returns:
- the size
-
hasID
public boolean hasID(byte[] id)
Returns whether the ID is present in the block.- Parameters:
id- the ID to check- Returns:
- true if present
-
findID
public int findID(byte[] id)
Returns the offset of the ID.- Parameters:
id- the ID to locate- Returns:
- the position, -1 if not found
-
getByte
public Byte getByte(int offset)
Returns the byte at the specified offset.- Parameters:
offset- the offset to use- Returns:
- the byte
-
getByte
public Byte getByte(byte[] id, int offset)
Returns the long with the given ID.- Parameters:
id- the ID of the floatoffset- the offset to use from the start of the ID- Returns:
- the long, null if not found
-
getLong
public Long getLong(int offset)
Returns the long at the specified offset.- Parameters:
offset- the offset to use- Returns:
- the long
-
getLong
public Long getLong(byte[] id, int offset)
Returns the long with the given ID.- Parameters:
id- the ID of the floatoffset- the offset to use from the start of the ID- Returns:
- the long, null if not found
-
getDouble
public Double getDouble(int offset)
Returns the double at the specified offset.- Parameters:
offset- starting pos- Returns:
- the double value, null if not found
-
getDouble
public Double getDouble(byte[] id, int offset)
Returns the double with the given ID.- Parameters:
id- the ID of the doubleoffset- the offset to use from the start of the ID- Returns:
- the double value, null if not found
-
getText
public String getText(int offset)
Returns the text at the specified offset.- Parameters:
offset- starting pos- Returns:
- the text value
-
getText
public String getText(byte[] id, int offset)
Returns the text with the given ID.- Parameters:
id- the ID of the textoffset- the offset to use from the start of the ID- Returns:
- the text value, null if not found
-
getBufferSection
public byte[] getBufferSection()
Returns the sub-section of the buffer (copy operation!).- Returns:
- copy of the sub-section of the buffer
-
-