|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.util.HexPrintStream
public class HexPrintStream
Class HexPrintStream provides an object that does everything a PrintStream
does, and that can print
integer values and byte arrays in hexadecimal. The hex print stream prints
into some underlying print stream.
Two predefined hex print streams are provided. HexPrintStream.out prints into System.out. HexPrintStream.err prints into System.err.
Field Summary | |
---|---|
static HexPrintStream |
err
A hex print stream that prints into System.err. |
static HexPrintStream |
out
A hex print stream that prints into System.out. |
Constructor Summary | |
---|---|
HexPrintStream(PrintStream ps)
Construct a new hex print stream that will print into the given underlying print stream. |
Method Summary | |
---|---|
void |
close()
Close this hex print stream. |
void |
flush()
Flush this hex print stream. |
PrintStream |
getPrintStream()
Returns this hex print stream's underlying print stream. |
void |
print(boolean b)
Print a boolean value to this hex print stream. |
void |
print(char c)
Print a character to this hex print stream. |
void |
print(char[] s)
Print an array of characters to this hex print stream. |
void |
print(double d)
Print a double-precision floating-point value to this hex print stream. |
void |
print(float f)
Print a single-precision floating-point value to this hex print stream. |
void |
print(int i)
Print an integer value to this hex print stream. |
void |
print(long l)
Print a long integer value to this hex print stream. |
void |
print(Object obj)
Print an object to this hex print stream. |
void |
print(String s)
Print a string to this hex print stream. |
void |
printhex(byte b)
Print a byte value in hexadecimal to this hex print stream. |
void |
printhex(byte[] buf)
Print a byte array in hexadecimal to this hex print stream. |
void |
printhex(byte[] buf,
int off,
int len)
Print a portion of a byte array in hexadecimal to this hex print stream. |
void |
printhex(char c)
Print a character value in hexadecimal to this hex print stream. |
void |
printhex(int i)
Print an integer value in hexadecimal to this hex print stream. |
void |
printhex(long l)
Print a long integer value in hexadecimal to this hex print stream. |
void |
println()
Print a line separator to this hex print stream. |
void |
println(boolean b)
Print a boolean value plus a line separator to this hex print stream. |
void |
println(char c)
Print a character plus a line separator to this hex print stream. |
void |
println(char[] s)
Print an array of characters plus a line separator to this hex print stream. |
void |
println(double d)
Print a double-precision floating-point value plus a line separator to this hex print stream. |
void |
println(float f)
Print a single-precision floating-point value plus a line separator to this hex print stream. |
void |
println(int i)
Print an integer value plus a line separator to this hex print stream. |
void |
println(long l)
Print a long integer value plus a line separator to this hex print stream. |
void |
println(Object obj)
Print an object plus a line separator to this hex print stream. |
void |
println(String s)
Print a string plus a line separator to this hex print stream. |
void |
printlnhex(byte b)
Print a byte value in hexadecimal plus a line separator to this hex print stream. |
void |
printlnhex(byte[] buf,
int n)
Print a byte array in hexadecimal with line separators to this hex print stream. |
void |
printlnhex(byte[] buf,
int off,
int len,
int n)
Print a portion of a byte array in hexadecimal with line separators to this hex print stream. |
void |
printlnhex(char c)
Print a character value in hexadecimal plus a line separator to this hex print stream. |
void |
printlnhex(int i)
Print an integer value in hexadecimal plus a line separator to this hex print stream. |
void |
printlnhex(long l)
Print a long integer value in hexadecimal plus a line separator to this hex print stream. |
void |
printStackTrace(Throwable exc)
Print the given exception's stack trace to this hex print stream. |
void |
write(byte[] buf)
Write the given byte array to this hex print stream. |
void |
write(byte[] buf,
int off,
int len)
Write a portion of the given byte array to this hex print stream. |
void |
write(int b)
Write the given byte to this hex print stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final HexPrintStream out
public static final HexPrintStream err
Constructor Detail |
---|
public HexPrintStream(PrintStream ps)
ps
- Underlying print stream.
NullPointerException
- (unchecked exception) Thrown if ps is null.Method Detail |
---|
public PrintStream getPrintStream()
public void flush()
public void close()
public void write(int b)
b
- Byte.public void write(byte[] buf)
buf
- Byte array.
NullPointerException
- (unchecked exception) Thrown if buf is null.public void write(byte[] buf, int off, int len)
buf
- Byte array.off
- Index of first byte to write.len
- Number of bytes to write.
NullPointerException
- (unchecked exception) Thrown if buf is null.
IndexOutOfBoundsException
- (unchecked exception) Thrown if off < 0, len
< 0, or off+len > buf.length.public void print(boolean b)
b
- Boolean value.public void print(char c)
c
- Character.public void print(int i)
i
- Integer value.public void print(long l)
l
- Long integer value.public void print(float f)
f
- Single-precision floating-point value.public void print(double d)
d
- Double-precision floating-point value.public void print(char[] s)
s
- Array of characters.public void print(String s)
s
- String.public void print(Object obj)
obj
- Object.public void println()
public void println(boolean b)
b
- Boolean value.public void println(char c)
c
- Character.public void println(int i)
i
- Integer value.public void println(long l)
l
- Long integer value.public void println(float f)
f
- Single-precision floating-point value.public void println(double d)
d
- Double-precision floating-point value.public void println(char[] s)
s
- Array of characters.public void println(String s)
s
- String.public void println(Object obj)
obj
- Object.public void printhex(byte b)
b
- Byte value.public void printhex(char c)
c
- Character value.public void printhex(int i)
i
- Integer value.public void printhex(long l)
l
- Long integer value.public void printhex(byte[] buf)
buf
- Byte array.
NullPointerException
- (unchecked exception) Thrown if buf is null.public void printhex(byte[] buf, int off, int len)
buf
- Byte array.off
- Index of first byte to write.len
- Number of bytes to write.
NullPointerException
- (unchecked exception) Thrown if buf is null.
IndexOutOfBoundsException
- (unchecked exception) Thrown if off < 0, len
< 0, or off+len > buf.length.public void printlnhex(byte b)
b
- Byte value.public void printlnhex(char c)
c
- Character value.public void printlnhex(int i)
i
- Integer value.public void printlnhex(long l)
l
- Long integer value.public void printlnhex(byte[] buf, int n)
buf
- Byte array.n
- Number of bytes per line.
NullPointerException
- (unchecked exception) Thrown if buf is null.
IllegalArgumentException
- (unchecked exception) Thrown if n < 1.public void printlnhex(byte[] buf, int off, int len, int n)
buf
- Byte array.off
- Index of first byte to write.len
- Number of bytes to write.n
- Number of bytes per line.
NullPointerException
- (unchecked exception) Thrown if buf is null.
IndexOutOfBoundsException
- (unchecked exception) Thrown if off < 0, len
< 0, or off+len > buf.length.
IllegalArgumentException
- (unchecked exception) Thrown if n < 1.public void printStackTrace(Throwable exc)
exc
- Exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |