Package org.djutils.decoderdumper
Class CharDecoder
- java.lang.Object
-
- org.djutils.decoderdumper.CharDecoder
-
- All Implemented Interfaces:
Decoder
public class CharDecoder extends Object implements Decoder
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version Jan 3, 2019
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Constructor Summary
Constructors Constructor Description CharDecoder(int fieldsPerLine, int extraSpaceAfterEvery)Construct a new CharDecoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappend(int address, byte theByte)Decode one (more) byte.intgetMaximumWidth()Retrieve 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).StringgetResult()Retrieve the current result of this Decoder.booleanignoreForIdenticalOutputCheck()If 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.StringtoString()
-
-
-
Method Detail
-
getResult
public String getResult()
Retrieve 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()
Retrieve 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:
- int; the maximum width (in characters) of results that this Decoder can return
-
append
public boolean append(int address, byte theByte) throws IOExceptionDecode 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- int; the address that corresponds with the bytetheByte- byte; the byte- Returns:
- boolean; 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 boolean ignoreForIdenticalOutputCheck()
If 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:
- boolean; true if the result of this Decoder should be ignored in testing for identical output lines; otherwise false
-
-