Package com.igormaznitsa.jbbp.compiler
Class JBBPCompiledBlock
java.lang.Object
com.igormaznitsa.jbbp.compiler.JBBPCompiledBlock
The Class describes a data block contains compiled information for a bin
parser script.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classInside helper to build a compiled block -
Method Summary
Modifier and TypeMethodDescriptionfindFieldForPath(String fieldPath) Find a field for its path.intfindFieldOffsetForPath(String fieldPath) Find offset of a field in the compiled block for its field path.Get the array size evaluatorsbyte[]Get the compiled data blockGet array contains parameter info of detected custom type fields.Get array contains the named field arrayGet the source which was used for compilationbooleanCheck that the compiled block contains array fields with calculated size.booleanCheck that the compiled block has var fields or arrays.static JBBPCompiledBlock.Builderprepare()The Method allows to create the new builder.
-
Method Details
-
prepare
The Method allows to create the new builder.- Returns:
- the new builder
-
getSource
Get the source which was used for compilation- Returns:
- the source as string
-
hasVarFields
public boolean hasVarFields()Check that the compiled block has var fields or arrays.- Returns:
- true if the compiled block contains any VAR field or VAR array, false otherwise
-
hasEvaluatedSizeArrays
public boolean hasEvaluatedSizeArrays()Check that the compiled block contains array fields with calculated size.- Returns:
- true if calculated size arrays are presented, false otherwise
-
getCompiledData
public byte[] getCompiledData()Get the compiled data block- Returns:
- the compiled data block contains the byte code of the script
-
getNamedFields
Get array contains the named field array- Returns:
- the named field item array
-
getCustomTypeFields
Get array contains parameter info of detected custom type fields.- Returns:
- the array contains the info for every registered custom type field.
-
getArraySizeEvaluators
Get the array size evaluators- Returns:
- the array size evaluators, it can be null if there is not any variable size array
-
findFieldForPath
Find a field for its path.- Parameters:
fieldPath- a field path- Returns:
- a field to be found for the path, null otherwise
-
findFieldOffsetForPath
Find offset of a field in the compiled block for its field path.- Parameters:
fieldPath- a field path, it must not be null- Returns:
- the offset as integer for the field path
- Throws:
JBBPException- if the field is not found
-