org.blinkenbyte.io
Class IOUtil

java.lang.Object
  extended by org.blinkenbyte.io.IOUtil

public class IOUtil
extends java.lang.Object

This is a utility class containing methods to help deal with I/O operations.


Method Summary
static int fillBuffer(BlockDevice bd, byte[] b)
          Reads up to b.length bytes into b.
static int fillBuffer(BlockDevice bd, byte[] b, int offset, int len)
          Reads up to len bytes into b at b[offset].
static int fillBuffer(java.io.InputStream inpStr, byte[] b)
          Reads up to b.length bytes into b.
static int fillBuffer(java.io.InputStream inpStr, byte[] b, int offset, int len)
          Reads up to len bytes into b at b[offset].
static int fillBuffer(ReadWriteDevice rwd, byte[] b)
          Reads up to b.length bytes into b.
static int fillBuffer(ReadWriteDevice rwd, byte[] b, int offset, int len)
          Reads up to len bytes into b at b[offset].
static void readFully(BlockDevice bd, byte[] b)
          Reads b.length bytes into b or throws an exception if end-of-stream is reached before all bytes can be read.
static void readFully(BlockDevice bd, byte[] b, int offset, int len)
          Reads len bytes into b at b[offset] or throws an exception if end-of-stream is reached before all bytes can be read.
static void readFully(java.io.InputStream inpStr, byte[] b)
          Reads b.length bytes into b or throws an exception if end-of-stream is reached before all bytes can be read.
static void readFully(java.io.InputStream inpStr, byte[] b, int offset, int len)
          Reads len bytes into b at b[offset] or throws an exception if end-of-stream is reached before all bytes can be read.
static void readFully(ReadWriteDevice rwd, byte[] b)
          Reads b.length bytes into b or throws an exception if end-of-stream is reached before all bytes can be read.
static void readFully(ReadWriteDevice rwd, byte[] b, int offset, int len)
          Reads len bytes into b at b[offset] or throws an exception if end-of-stream is reached before all bytes can be read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readFully

public static void readFully(java.io.InputStream inpStr,
                             byte[] b)
                      throws java.io.IOException
Reads b.length bytes into b or throws an exception if end-of-stream is reached before all bytes can be read.

Throws:
java.io.IOException

readFully

public static void readFully(java.io.InputStream inpStr,
                             byte[] b,
                             int offset,
                             int len)
                      throws java.io.IOException
Reads len bytes into b at b[offset] or throws an exception if end-of-stream is reached before all bytes can be read.

Throws:
java.io.IOException

fillBuffer

public static int fillBuffer(java.io.InputStream inpStr,
                             byte[] b)
                      throws java.io.IOException
Reads up to b.length bytes into b. Repeated reads are made until either b.length bytes are read or the end-of-stream is reached.

Throws:
java.io.IOException

fillBuffer

public static int fillBuffer(java.io.InputStream inpStr,
                             byte[] b,
                             int offset,
                             int len)
                      throws java.io.IOException
Reads up to len bytes into b at b[offset]. Repeated reads are made until either len bytes are read or the end-of-stream is reached.

Throws:
java.io.IOException

readFully

public static void readFully(ReadWriteDevice rwd,
                             byte[] b)
                      throws java.io.IOException
Reads b.length bytes into b or throws an exception if end-of-stream is reached before all bytes can be read.

Throws:
java.io.IOException

readFully

public static void readFully(ReadWriteDevice rwd,
                             byte[] b,
                             int offset,
                             int len)
                      throws java.io.IOException
Reads len bytes into b at b[offset] or throws an exception if end-of-stream is reached before all bytes can be read.

Throws:
java.io.IOException

fillBuffer

public static int fillBuffer(ReadWriteDevice rwd,
                             byte[] b)
                      throws java.io.IOException
Reads up to b.length bytes into b. Repeated reads are made until either b.length bytes are read or the end-of-stream is reached.

Throws:
java.io.IOException

fillBuffer

public static int fillBuffer(ReadWriteDevice rwd,
                             byte[] b,
                             int offset,
                             int len)
                      throws java.io.IOException
Reads up to len bytes into b at b[offset]. Repeated reads are made until either len bytes are read or the end-of-stream is reached.

Throws:
java.io.IOException

readFully

public static void readFully(BlockDevice bd,
                             byte[] b)
                      throws java.io.IOException
Reads b.length bytes into b or throws an exception if end-of-stream is reached before all bytes can be read.

Throws:
java.io.IOException

readFully

public static void readFully(BlockDevice bd,
                             byte[] b,
                             int offset,
                             int len)
                      throws java.io.IOException
Reads len bytes into b at b[offset] or throws an exception if end-of-stream is reached before all bytes can be read.

Throws:
java.io.IOException

fillBuffer

public static int fillBuffer(BlockDevice bd,
                             byte[] b)
                      throws java.io.IOException
Reads up to b.length bytes into b. Repeated reads are made until either b.length bytes are read or the end-of-stream is reached.

Throws:
java.io.IOException

fillBuffer

public static int fillBuffer(BlockDevice bd,
                             byte[] b,
                             int offset,
                             int len)
                      throws java.io.IOException
Reads up to len bytes into b at b[offset]. Repeated reads are made until either len bytes are read or the end-of-stream is reached.

Throws:
java.io.IOException