1 package org.djutils.decoderdumper; 2 3 import java.io.IOException; 4 5 /** 6 * Decoder interface. 7 * <p> 8 * Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 9 * BSD-style license. See <a href="https://djutils.org/docs/current/djutils/licenses.html">DJUTILS License</a>. 10 * <p> 11 * @version $Revision$, $LastChangedDate$, by $Author$, initial version Jan 3, 2019 <br> 12 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a> 13 * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a> 14 */ 15 public interface Decoder 16 { 17 /** 18 * Retrieve the current result of this Decoder. Decoders that handle multiple byte input may be somewhere within a token. 19 * Such Decoders should report a partial result. If no data has been added, the result must be the empty string. 20 * @return String; the current result of this Decoder 21 */ 22 String getResult(); 23 24 /** 25 * Retrieve the maximum width (in characters) of results that this Decoder can return (all shorter results will be padded to 26 * this width with spaces, unless this is the last active Decoder). 27 * @return int; the maximum width (in characters) of results that this Decoder can return 28 */ 29 int getMaximumWidth(); 30 31 /** 32 * Decode one (more) byte. This method must return true when a line becomes full due to this call, otherwise this method 33 * must return false. 34 * @param address int; the address that corresponds with the byte 35 * @param theByte byte; the byte 36 * @return boolean; true if an output line has been completed by this call; false if at least one more byte can be appended 37 * to the local accumulator before the current output line is full 38 * @throws IOException when the output device throws this exception 39 */ 40 boolean append(int address, byte theByte) throws IOException; 41 42 /** 43 * If the result of this Decoder should not be used to compare output lines for suppressing identical lines, this method 44 * should return true; otherwise it should return false. 45 * @return boolean; true if the result of this Decoder should be ignored in testing for identical output lines; otherwise 46 * false 47 */ 48 boolean ignoreForIdenticalOutputCheck(); 49 50 }