org.yajul.io
Class HexDumpOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.yajul.io.HexEncodingOutputStream
org.yajul.io.HexDumpOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class HexDumpOutputStream
- extends HexEncodingOutputStream
An output stream that prints lines of hexadecimal output containing the byte
offset (in hex), the hex representation of the types, and the ASCII representation
of the bytes.
User: josh
Date: Jan 11, 2004
Time: 9:23:13 PM
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary |
HexDumpOutputStream(java.io.OutputStream out,
int width)
Creates an output stream filter built on top of the specified
underlying output stream. |
Method Summary |
void |
flush()
Flushes this output stream and forces any buffered output bytes
to be written out to the stream. |
static java.lang.String |
toHexString(byte[] buf,
int length)
Returns a hex representation of the buffer. |
void |
write(int b)
Writes the specified byte to this output stream. |
Methods inherited from class java.io.FilterOutputStream |
close, 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.OutputStream out,
int width)
- Creates an output stream filter built on top of the specified
underlying output stream.
- Parameters:
out
- the underlying output stream to be assigned to
the field this.out for later use, or
null
if this instance is to be
created without an underlying stream.width
- The number of bytes to print in a line of output.
toHexString
public static java.lang.String toHexString(byte[] buf,
int length)
- Returns a hex representation of the buffer.
- Parameters:
buf
- The buffer.length
- The length
- Returns:
- String - a hex representation of the buffer.
write
public void write(int b)
throws java.io.IOException
- Writes the specified
byte
to this output stream.
The write
method of FilterOutputStream
calls the write
method of its underlying output stream,
that is, it performs out.write(b).
Implements the abstract write method of OutputStream.
- Overrides:
write
in class HexEncodingOutputStream
- Parameters:
b
- the byte
.
- Throws:
java.io.IOException
- if an I/O error occurs.
flush
public void flush()
throws java.io.IOException
- Flushes this output stream and forces any buffered output bytes
to be written out to the stream.
The
flush
method of FilterOutputStream
calls the flush
method of its underlying output stream.
- Specified by:
flush
in interface java.io.Flushable
- Overrides:
flush
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.- See Also:
FilterOutputStream.out
Copyright © 2008. All Rights Reserved.