Overview | Package | Class | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openorb.io
Class HexPrintStream

    java.lang.Object
      |
      +--java.io.OutputStream
            |
            +--java.io.FilterOutputStream
                  |
                  +--org.openorb.io.HexPrintStream

public class HexPrintStream
extends java.io.FilterOutputStream

This filter stream is used to write binary data out as formatted hex digits in one of four formats.

Version:
  $Revision: 1.11 $ $Date: 2002/07/14 19:12:34 $
Author:
  Chris Wood

Field Summary
`static int` | `FORMAT_HEXONLY` This format writes data out line by line, with breaks on word boundaries boundaries.
`static int` | `FORMAT_MIXED` This format prints out the ASCII data in the left column and the corresponding hex data in the right column, with breaks on word boundaries.
`static int` | `FORMAT_MIXED_TWOLINE` This format prints out ASCII chars above the hex codes.
`static int` | `FORMAT_SIMPLE` Simple format.

Constructor Summary
`HexPrintStream(java.io.OutputStream out)` Create new HexPrintStream.
`HexPrintStream(java.io.OutputStream out, int format)` Create new HexPrintStream and select the format.

Method Summary
`void` | `close()` Close the stream.
`void` | `flush()` Flush the stream.
`int` | `getFormat()`
`static void` | `main(java.lang.String[] args)`
`void` | `setFormat(int format)` Change the output format.
`static java.lang.String` | `toHex(byte val)` Convert a byte value into hexadecimal string representation.
`static java.lang.String` | `toHex(int val)` Convert an integer value into hexadecimal string representation.
`static java.lang.String` | `toHex(short val)` Convert a short value into hexadecimal string representation.
`void` | `write(byte[] buf)` Write an array of bytes to the stream.
`void` | `write(byte[] buf, int off, int len)` Write an array of bytes to the stream.
`void` | `write(int val)` Write a single byte to the stream.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FORMAT_SIMPLE

    public static final int FORMAT_SIMPLE

  Simple format. Each input byte is transformed directly into it's hex equivalent and written to the output stream.

### FORMAT_HEXONLY

    public static final int FORMAT_HEXONLY

  This format writes data out line by line, with breaks on word boundaries boundaries. To complete writing the stream must be flushed.

### FORMAT_MIXED

    public static final int FORMAT_MIXED

  This format prints out the ASCII data in the left column and the corresponding hex data in the right column, with breaks on word boundaries. To complete writing a partial line the stream must be flushed.

### FORMAT_MIXED_TWOLINE

    public static final int FORMAT_MIXED_TWOLINE

  This format prints out ASCII chars above the hex codes. To complete writing a partial line the stream must be flushed.

Constructor Detail

### HexPrintStream

    public HexPrintStream(java.io.OutputStream out)

  Create new HexPrintStream. This uses FORMAT_SIMPLE

### HexPrintStream

    public HexPrintStream(java.io.OutputStream out,
                          int format)

  Create new HexPrintStream and select the format.

Method Detail

### write

    public void write(int val)
               throws java.io.IOException

  Write a single byte to the stream.
  Overrides:
    `write` in class `java.io.FilterOutputStream`

### write

    public void write(byte[] buf)
               throws java.io.IOException

  Write an array of bytes to the stream.
  Overrides:
    `write` in class `java.io.FilterOutputStream`

### write

    public void write(byte[] buf,
                      int off,
                      int len)
               throws java.io.IOException

  Write an array of bytes to the stream.
  Overrides:
    `write` in class `java.io.FilterOutputStream`

### flush

    public void flush()
               throws java.io.IOException

  Flush the stream. For some formats this causes a line break to occour.
  Overrides:
    `flush` in class `java.io.FilterOutputStream`

### close

    public void close()
               throws java.io.IOException

  Close the stream. Flush, then call close on the underlying stream.
  Overrides:
    `close` in class `java.io.FilterOutputStream`

### getFormat

    public int getFormat()

### setFormat

    public void setFormat(int format)

  Change the output format. This causes a flush before the format is changed.

### toHex

    public static java.lang.String toHex(int val)

  Convert an integer value into hexadecimal string representation.
  Parameters:
    `val` - Integer value to convert.
  Returns:
    String with the hexadecimal representation of the integer val.

### toHex

    public static java.lang.String toHex(short val)

  Convert a short value into hexadecimal string representation.
  Parameters:
    `val` - Short value to convert.
  Returns:
    String with the hexadecimal representation of the short val.

### toHex

    public static java.lang.String toHex(byte val)

  Convert a byte value into hexadecimal string representation.
  Parameters:
    `val` - Byte value to convert.
  Returns:
    String with the hexadecimal representation of the byte val.

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD