T - Type of dumperpublic class Dumper<T> extends Object
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
| Constructor and Description |
|---|
Dumper()
Construct a new Dumper with addressOffset 0.
|
Dumper(int addressOffset)
Construct a new Dumper.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDecoder(Decoder decoder)
Add a Decoder at the end of the current list of decoders.
|
Dumper<T> |
addDecoder(int index,
Decoder decoder)
Add a Decoder at a specified index.
|
boolean |
append(byte theByte)
Append one byte to this dump.
|
Dumper<T> |
append(byte[] bytes)
Append an array of bytes.
|
Dumper<T> |
append(byte[] bytes,
int start,
int len)
Append a slice of an array of bytes.
|
Dumper<T> |
append(InputStream inputStream)
Consume an entire input stream and append what it produces to this Dumpmer.
|
boolean |
flush()
Force the currently assembled output to be written (write partial result if the output line currently being assembled is
not full).
|
int |
getMaximumWidth()
Return the maximum width of an output line.
|
Dumper<T> |
setOutputStream(OutputStream newOutputStream)
Set or replace the active output stream.
|
Dumper<T> |
setSuppressMultipleIdenticalLines(boolean newState)
Set the output compression mode.
|
String |
toString() |
public Dumper(int addressOffset)
addressOffset - int; address for the first byte that will be appendedpublic Dumper()
public Dumper<T> setOutputStream(OutputStream newOutputStream)
System.out.)newOutputStream - OutputStream; the new output streampublic Dumper<T> setSuppressMultipleIdenticalLines(boolean newState)
newState - boolean; if true; groups of three or more output lines with the significant content are compressed; if
false; no output is suppressedpublic void addDecoder(Decoder decoder)
decoder - Decoder; the decoder to add or insertpublic Dumper<T> addDecoder(int index, Decoder decoder) throws IndexOutOfBoundsException
index - int; the position where the Decoder must be added (inserted)decoder - Decoder; the decoder to add or insertIndexOutOfBoundsException - when the provided index is invalidpublic boolean append(byte theByte)
throws IOException
theByte - byte; the byte to appendIOException - when output was generated and writing to the output stream generated an IOExceptionpublic Dumper<T> append(byte[] bytes) throws IOException
bytes - byte[]; the bytes to appendIOException - when an outputStream has been set and it throws an IOExceptionpublic Dumper<T> append(byte[] bytes, int start, int len) throws IOException
bytes - byte[]; byte array from which to take the bytes to appendstart - int; index of first byte in bytes to append (NB. using non-zero does not cause a jump in
the address that is printed before the dumped bytes)len - int; number of bytes to appendIOException - when an outputStream has been set and it throws an IOExceptionpublic Dumper<T> append(InputStream inputStream) throws IOException
append method. This method does not return until the inputStream returns end of file, or throws
an IOException (which is - actually - not a return to the caller, but a jump to the closest handler for that exception).inputStream - InputStream; the input stream that is to be consumedIOException - when the inputStream throws that exception, or when an output stream has been set and
that throws an IOExceptionpublic boolean flush()
throws IOException
IOException - when output was generated and writing to the output stream generated an IOExceptionpublic int getMaximumWidth()
Copyright © 2018–2019 Delft University of Technology. All rights reserved.