Class SerialDataDecoder

java.lang.Object
org.djutils.serialization.SerialDataDecoder
All Implemented Interfaces:
org.djutils.decoderdumper.Decoder

public class SerialDataDecoder extends Object implements org.djutils.decoderdumper.Decoder
Decoder for inspection of serialized data. The SerialDataDecoder implements a state machine that processes one byte at a time. Output is sent to the buffer (a StringBuilder).

Copyright (c) 2013-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.

Author:
Alexander Verbraeck, Peter Knoppers
  • Constructor Details

    • SerialDataDecoder

      public SerialDataDecoder(EndianUtil endianUtil)
      Construct a new SerialDataDecoder.
      Parameters:
      endianUtil - the endian util to use to decode multi-byte values
  • Method Details

    • getResult

      public final String getResult()
      Specified by:
      getResult in interface org.djutils.decoderdumper.Decoder
    • getMaximumWidth

      public final int getMaximumWidth()
      Specified by:
      getMaximumWidth in interface org.djutils.decoderdumper.Decoder
    • append

      public final boolean append(int address, byte theByte) throws IOException
      Decode one (more) byte. This method must return true when a line becomes full due to this call, otherwise this method must return false.
      Specified by:
      append in interface org.djutils.decoderdumper.Decoder
      Parameters:
      address - the address that corresponds with the byte, for printing purposes.
      theByte - the byte to process
      Returns:
      true if an output line has been completed by this call; false if at least one more byte can be appended to the local accumulator before the current output line is full
      Throws:
      IOException - when the output device throws this exception
    • ignoreForIdenticalOutputCheck

      public final boolean ignoreForIdenticalOutputCheck()
      Specified by:
      ignoreForIdenticalOutputCheck in interface org.djutils.decoderdumper.Decoder