java.lang.Object | +--com.dalsemi.onewire.utils.IOHelper
Generic IO routines. Supports printing and reading arrays of bytes. Also, using the setReader and setWriter methods, the source of the bytes can come from any stream as well as the destination for written bytes. All routines are static and final and handle all exceptional cases by returning a default value.
Method Summary | |
static byte[] |
readBytes(int count,
int pad,
boolean hex)
|
static byte[] |
readBytesAsc(int count,
int pad)
|
static byte[] |
readBytesHex(int count,
int pad)
|
static int |
readInt()
|
static int |
readInt(int def)
|
static String |
readLine()
|
static void |
setReader(Reader r)
|
static void |
setWriter(Writer w)
|
static void |
write(boolean b)
|
static void |
write(int i)
|
static void |
write(Object o)
|
static void |
write(String s)
|
static void |
writeBytes(byte[] b)
Writes a byte[] to the specified output stream. |
static void |
writeBytes(byte[] b,
int offset,
int cnt)
|
static void |
writeBytes(String delim,
byte[] b,
int offset,
int cnt)
Writes a byte[] to the specified output stream. |
static void |
writeBytesHex(byte[] b)
|
static void |
writeBytesHex(byte[] b,
int offset,
int cnt)
|
static void |
writeBytesHex(String delim,
byte[] b,
int offset,
int cnt)
|
static void |
writeHex(byte b)
|
static void |
writeHex(long l)
|
static void |
writeLine()
|
static void |
writeLine(boolean b)
|
static void |
writeLine(int i)
|
static void |
writeLine(Object o)
|
static void |
writeLine(String s)
|
static void |
writeLineHex(byte b)
|
static void |
writeLineHex(long l)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static final void setReader(Reader r)
public static final String readLine()
public static final byte[] readBytes(int count, int pad, boolean hex)
public static final byte[] readBytesHex(int count, int pad)
public static final byte[] readBytesAsc(int count, int pad)
public static final int readInt()
public static final int readInt(int def)
public static final void setWriter(Writer w)
public static final void writeBytesHex(String delim, byte[] b, int offset, int cnt)
public static final void writeBytesHex(byte[] b, int offset, int cnt)
public static final void writeBytesHex(byte[] b)
public static final void writeBytes(String delim, byte[] b, int offset, int cnt)
byte[]
to the specified output stream. This method
writes a combined hex and ascii representation where each line has
(at most) 16 bytes of data in hex followed by three spaces and the ascii
representation of those bytes. To write out just the Hex representation,
use writeBytesHex(byte[],int,int)
.b
- the byte array to print out.offset
- the starting location to begin printingcnt
- the number of bytes to print.public static final void writeBytes(byte[] b)
byte[]
to the specified output stream. This method
writes a combined hex and ascii representation where each line has
(at most) 16 bytes of data in hex followed by three spaces and the ascii
representation of those bytes. To write out just the Hex representation,
use writeBytesHex(byte[],int,int)
.b
- the byte array to print out.public static final void writeBytes(byte[] b, int offset, int cnt)
public static final void write(String s)
public static final void write(Object o)
public static final void write(boolean b)
public static final void write(int i)
public static final void writeLine()
public static final void writeLine(String s)
public static final void writeLine(Object o)
public static final void writeLine(boolean b)
public static final void writeLine(int i)
public static final void writeHex(byte b)
public static final void writeHex(long l)
public static final void writeLineHex(byte b)
public static final void writeLineHex(long l)