@@ -158,7 +158,8 @@ public final CompiledBlockVisitor visit() {
158158 final JBBPIntegerValueEvaluator numberOfBits =
159159 extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator (
160160 JBBPUtils .unpackInt (compiledData , positionAtCompiledBlock ));
161- visitBitField (theOffset , byteOrder , name , numberOfBits , arraySizeEvaluator );
161+ visitBitField (theOffset , byteOrder , name , readWholeStream , numberOfBits ,
162+ arraySizeEvaluator );
162163 }
163164 break ;
164165
@@ -175,7 +176,7 @@ public final CompiledBlockVisitor visit() {
175176 break ;
176177
177178 case JBBPCompiler .CODE_STRUCT_START : {
178- visitStructureStart (theOffset , byteOrder , name , arraySizeEvaluator );
179+ visitStructureStart (theOffset , byteOrder , readWholeStream , name , arraySizeEvaluator );
179180 }
180181 break ;
181182
@@ -230,15 +231,16 @@ public void visitActionItem(int offsetInCompiledBlock, int actionType,
230231 }
231232
232233 /**
233- * Visit field contains virtual field with VAL type.
234+ * Visit field contains virtual field defined through VAL type.
234235 *
235236 * @param offsetInCompiledBlock offset in the compiled block
236237 * @param byteOrder byteOrder
237238 * @param nameFieldInfo name of the field, must not be null
238239 * @param expression expression to calculate value
239240 * @since 1.4.0
240241 */
241- public void visitValField (int offsetInCompiledBlock , JBBPByteOrder byteOrder ,
242+ public void visitValField (int offsetInCompiledBlock ,
243+ JBBPByteOrder byteOrder ,
242244 JBBPNamedFieldInfo nameFieldInfo ,
243245 JBBPIntegerValueEvaluator expression ) {
244246 }
@@ -262,54 +264,106 @@ public void visitValField(int offsetInCompiledBlock, JBBPByteOrder byteOrder,
262264 * @see JBBPCompiler#CODE_LONG
263265 * @see JBBPCompiler#CODE_SKIP
264266 */
265- public void visitPrimitiveField (int offsetInCompiledBlock , int primitiveType ,
266- JBBPNamedFieldInfo nullableNameFieldInfo , JBBPByteOrder byteOrder ,
267- boolean readWholeStreamAsArray , boolean altFieldType ,
267+ public void visitPrimitiveField (int offsetInCompiledBlock ,
268+ int primitiveType ,
269+ JBBPNamedFieldInfo nullableNameFieldInfo ,
270+ JBBPByteOrder byteOrder ,
271+ boolean readWholeStreamAsArray ,
272+ boolean altFieldType ,
268273 JBBPIntegerValueEvaluator nullableArraySize ) {
269274 }
270275
271276 /**
272277 * Visit a variable field (which is defined with var data type)
273278 *
274- * @param offsetInCompiledBlock offset in the compiled block
275- * @param nullableNameFieldInfo field info, null if the field is anonymous one
276- * @param byteOrder byte order for the field, must not be null
277- * @param readWholeStreamIntoArray true if whole stream should be read as array of var type, false otherwise
278- * @param nullableArraySize if not null then evaluator of array size to be read from stream
279- * @param extraDataValueEvaluator if not null then extra data evaluator for the var field
279+ * @param offsetInCompiledBlock offset in the compiled block
280+ * @param nullableNameFieldInfo field info, null if the field is anonymous one
281+ * @param byteOrder byte order for the field, must not be null
282+ * @param readWholeStream true if whole stream should be read as array of var type, false otherwise
283+ * @param nullableArraySize if not null then evaluator of array size to be read from stream
284+ * @param extraDataValue if not null then extra data evaluator for the var field
280285 */
281- public void visitVarField (int offsetInCompiledBlock , JBBPNamedFieldInfo nullableNameFieldInfo ,
282- JBBPByteOrder byteOrder , boolean readWholeStreamIntoArray ,
286+ public void visitVarField (int offsetInCompiledBlock ,
287+ JBBPNamedFieldInfo nullableNameFieldInfo ,
288+ JBBPByteOrder byteOrder ,
289+ boolean readWholeStream ,
283290 JBBPIntegerValueEvaluator nullableArraySize ,
284- JBBPIntegerValueEvaluator extraDataValueEvaluator ) {
291+ JBBPIntegerValueEvaluator extraDataValue ) {
285292 }
286293
294+ /**
295+ * Visit a custom type field.
296+ *
297+ * @param offsetInCompiledBlock offset in the compiled block
298+ * @param notNullFieldType field type info, must not be null
299+ * @param nullableNameFieldInfo field info, null if the field is anonymous one
300+ * @param byteOrder byte order for the field, must not be null
301+ * @param readWholeStream true if whole stream should be read as array of var type, false otherwise
302+ * @param nullableArraySize if not null then evaluator of array size to be read from stream
303+ * @param extraDataValue if not null then extra data evaluator for the var field
304+ */
287305 public void visitCustomField (int offsetInCompiledBlock ,
288306 JBBPFieldTypeParameterContainer notNullFieldType ,
289- JBBPNamedFieldInfo nullableNameFieldInfo , JBBPByteOrder byteOrder ,
307+ JBBPNamedFieldInfo nullableNameFieldInfo ,
308+ JBBPByteOrder byteOrder ,
290309 boolean readWholeStream ,
291- JBBPIntegerValueEvaluator nullableArraySizeEvaluator ,
292- JBBPIntegerValueEvaluator extraDataValueEvaluator ) {
310+ JBBPIntegerValueEvaluator nullableArraySize ,
311+ JBBPIntegerValueEvaluator extraDataValue ) {
293312 }
294313
295- public void visitBitField (int offsetInCompiledBlock , JBBPByteOrder byteOrder ,
314+ /**
315+ * Visit a custom type field.
316+ *
317+ * @param offsetInCompiledBlock offset in the compiled block
318+ * @param byteOrder byte order for the field, must not be null
319+ * @param nullableNameFieldInfo field info, null if the field is anonymous one
320+ * @param readWholeStream true if whole stream should be read as array of var type, false otherwise
321+ * @param notNullFieldSize evaluator to calculate size of the field, must not be null
322+ * @param nullableArraySize if not null then evaluator of array size to be read from stream
323+ */
324+ public void visitBitField (int offsetInCompiledBlock ,
325+ JBBPByteOrder byteOrder ,
296326 JBBPNamedFieldInfo nullableNameFieldInfo ,
327+ boolean readWholeStream ,
297328 JBBPIntegerValueEvaluator notNullFieldSize ,
298329 JBBPIntegerValueEvaluator nullableArraySize ) {
299330 }
300331
301- public void visitStructureStart (int offsetInCompiledBlock , JBBPByteOrder byteOrder ,
332+ /**
333+ * Visit a structure field.
334+ *
335+ * @param offsetInCompiledBlock offset in the compiled block
336+ * @param byteOrder byte order for the field, must not be null
337+ * @param readWholeStream true if whole stream should be read as array of var type, false otherwise
338+ * @param nullableNameFieldInfo field info, null if the field is anonymous one
339+ * @param nullableArraySize if not null then evaluator of array size to be read from stream
340+ */
341+ public void visitStructureStart (int offsetInCompiledBlock ,
342+ JBBPByteOrder byteOrder ,
343+ boolean readWholeStream ,
302344 JBBPNamedFieldInfo nullableNameFieldInfo ,
303345 JBBPIntegerValueEvaluator nullableArraySize ) {
304346 }
305347
348+ /**
349+ * End visit of a structure
350+ *
351+ * @param offsetInCompiledBlock offset in the compiled block
352+ * @param nullableNameFieldInfo field info, null if the field is anonymous one
353+ */
306354 public void visitStructureEnd (int offsetInCompiledBlock ,
307355 JBBPNamedFieldInfo nullableNameFieldInfo ) {
308356 }
309357
358+ /**
359+ * Called before visit of each item.
360+ */
310361 public void visitStart () {
311362 }
312363
364+ /**
365+ * Called after visit each item.
366+ */
313367 public void visitEnd () {
314368 }
315369
0 commit comments