Package com.dalsemi.onewire.utils
Class IOHelper
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
Modifier and TypeMethodDescriptionstatic final byte[]
readBytes
(int count, int pad, boolean hex) static final byte[]
readBytesAsc
(int count, int pad) static final byte[]
readBytesHex
(int count, int pad) static final int
readInt()
static final int
readInt
(int def) static final String
readLine()
static final void
static final void
static final void
write
(boolean b) static final void
write
(int i) static final void
static final void
static final void
writeBytes
(byte[] b) Writes abyte[]
to the specified output stream.static final void
writeBytes
(byte[] b, int offset, int cnt) static final void
writeBytes
(String delim, byte[] b, int offset, int cnt) Writes abyte[]
to the specified output stream.static final void
writeBytesHex
(byte[] b) static final void
writeBytesHex
(byte[] b, int offset, int cnt) static final void
writeBytesHex
(String delim, byte[] b, int offset, int cnt) static final void
writeHex
(byte b) static final void
writeHex
(long l) static final void
static final void
writeLine
(boolean b) static final void
writeLine
(int i) static final void
static final void
static final void
writeLineHex
(byte b) static final void
writeLineHex
(long l)
-
Method Details
-
setReader
-
readLine
-
readBytes
public static final byte[] readBytes(int count, int pad, boolean hex) -
readBytesHex
public static final byte[] readBytesHex(int count, int pad) -
readBytesAsc
public static final byte[] readBytesAsc(int count, int pad) -
readInt
public static final int readInt() -
readInt
public static final int readInt(int def) -
setWriter
-
writeBytesHex
-
writeBytesHex
public static final void writeBytesHex(byte[] b, int offset, int cnt) -
writeBytesHex
public static final void writeBytesHex(byte[] b) -
writeBytes
Writes abyte[]
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, usewriteBytesHex(byte[],int,int)
.- Parameters:
b
- the byte array to print out.offset
- the starting location to begin printingcnt
- the number of bytes to print.
-
writeBytes
public static final void writeBytes(byte[] b) Writes abyte[]
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, usewriteBytesHex(byte[],int,int)
.- Parameters:
b
- the byte array to print out.
-
writeBytes
public static final void writeBytes(byte[] b, int offset, int cnt) -
write
-
write
-
write
public static final void write(boolean b) -
write
public static final void write(int i) -
writeLine
public static final void writeLine() -
writeLine
-
writeLine
-
writeLine
public static final void writeLine(boolean b) -
writeLine
public static final void writeLine(int i) -
writeHex
public static final void writeHex(byte b) -
writeHex
public static final void writeHex(long l) -
writeLineHex
public static final void writeLineHex(byte b) -
writeLineHex
public static final void writeLineHex(long l)
-