Package org.djutils.decoderdumper
Class HexAddressDecoder
java.lang.Object
org.djutils.decoderdumper.HexAddressDecoder
- All Implemented Interfaces:
Decoder
Keep track of the address of the decoder-dumper and call flushLine when the last possible address of a line is received.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanappend(int address, byte theByte) Decode one (more) byte.intRetrieve the maximum width (in characters) of results that this Decoder can return (all shorter results will be padded to this width with spaces, unless this is the last active Decoder).Retrieve the current result of this Decoder.booleanIf the result of this Decoder should not be used to compare output lines for suppressing identical lines, this method should return true; otherwise it should return false.toString()
-
Constructor Details
-
HexAddressDecoder
public HexAddressDecoder(int roundToMultiple) Construct a new HexAddressDecoder.- Parameters:
roundToMultiple- if > 1 round addresses down to the nearest (lower) multiple of this value and the append method will return true when the last byte before such a multiple is added.
-
-
Method Details
-
getResult
Description copied from interface:DecoderRetrieve the current result of this Decoder. Decoders that handle multiple byte input may be somewhere within a token. Such Decoders should report a partial result. If no data has been added, the result must be the empty string. -
getMaximumWidth
public int getMaximumWidth()Description copied from interface:DecoderRetrieve the maximum width (in characters) of results that this Decoder can return (all shorter results will be padded to this width with spaces, unless this is the last active Decoder).- Specified by:
getMaximumWidthin interfaceDecoder- Returns:
- the maximum width (in characters) of results that this Decoder can return
-
append
public boolean append(int address, byte theByte) Description copied from interface:DecoderDecode 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:
appendin interfaceDecoder- Parameters:
address- the address that corresponds with the bytetheByte- the byte- 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
-
ignoreForIdenticalOutputCheck
public boolean ignoreForIdenticalOutputCheck()Description copied from interface:DecoderIf the result of this Decoder should not be used to compare output lines for suppressing identical lines, this method should return true; otherwise it should return false.- Specified by:
ignoreForIdenticalOutputCheckin interfaceDecoder- Returns:
- true if the result of this Decoder should be ignored in testing for identical output lines; otherwise false
-
toString
-