com.dalsemi.onewire.utils
Class IOHelper

java.lang.Object
  |
  +--com.dalsemi.onewire.utils.IOHelper

public final class IOHelper
extends Object

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.

Version:
0.02, 2 June 2001

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

setReader

public static final void setReader(Reader r)

readLine

public static final String 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

public static final void setWriter(Writer w)

writeBytesHex

public static final void writeBytesHex(String delim,
                                       byte[] b,
                                       int offset,
                                       int cnt)

writeBytesHex

public static final void writeBytesHex(byte[] b,
                                       int offset,
                                       int cnt)

writeBytesHex

public static final void writeBytesHex(byte[] b)

writeBytes

public static final void writeBytes(String delim,
                                    byte[] b,
                                    int offset,
                                    int cnt)
Writes a 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).
Parameters:
b - the byte array to print out.
offset - the starting location to begin printing
cnt - the number of bytes to print.

writeBytes

public static final void writeBytes(byte[] b)
Writes a 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).
Parameters:
b - the byte array to print out.

writeBytes

public static final void writeBytes(byte[] b,
                                    int offset,
                                    int cnt)

write

public static final void write(String s)

write

public static final void write(Object o)

write

public static final void write(boolean b)

write

public static final void write(int i)

writeLine

public static final void writeLine()

writeLine

public static final void writeLine(String s)

writeLine

public static final void writeLine(Object o)

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)