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.
  • Method Details

    • 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)