ikrs.util
Class HexDumpOutputStream
java.lang.Object
java.io.OutputStream
ikrs.util.HexDumpOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class HexDumpOutputStream
- extends java.io.OutputStream
A simple hexadecimal dump class as an OutputStream.
Note: this class is not synchronized.
Constructor Summary |
HexDumpOutputStream(java.io.Writer writer)
Create a new HexDumpWriter with the given core writer. |
HexDumpOutputStream(java.io.Writer writer,
int[] blockSizes)
Create a new HexDumpWriter with the given core writer. |
Method Summary |
void |
close()
|
void |
flush()
|
boolean |
isClosed()
This method checks if this stream (and the underlying writer) is closed. |
static void |
main(java.lang.String[] argv)
|
void |
write(int b)
|
Methods inherited from class java.io.OutputStream |
write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HexDumpOutputStream
public HexDumpOutputStream(java.io.Writer writer)
throws java.lang.NullPointerException
- Create a new HexDumpWriter with the given core writer.
This constructor will use a default block pattern with 8, 8, 0, 8, 8
bytes width.
- Parameters:
out
- The underlying writer object (must not be null).
- Throws:
java.lang.NullPointerException
- If the passed stream is null.
HexDumpOutputStream
public HexDumpOutputStream(java.io.Writer writer,
int[] blockSizes)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
- Create a new HexDumpWriter with the given core writer.
The passed blockSizes-array should contain a set of int elements - each >= 0 -
where each specify the byte-size for each block to be printed.
Zero-elements (0) are allowed to create spacer columns but the sum of all
must not be null.
- Parameters:
out
- The underlying writer object (must not be null).blockSizes
- The desired output block size (in bytes, not in chars).
- Throws:
java.lang.NullPointerException
- If the passed writer or blockSizes array is null.
java.lang.IllegalArgumentException
- If the blockSizes array is empty or has no non-zero element sum.
isClosed
public boolean isClosed()
- This method checks if this stream (and the underlying writer) is closed.
If closed no more write operations are permitted.
- Returns:
- True if (and only if) this stream was closed.
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.OutputStream
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush
in interface java.io.Flushable
- Overrides:
flush
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(int b)
throws java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] argv)