com.calitha.io
Class ReadWrapper

java.lang.Object
  extended by com.calitha.io.ReadWrapper

public class ReadWrapper
extends Object

A ReadWrapper object is used to use read and write methods on an input stream and random access file without having to know which of those you you are currently dealing with.

The existence of the class is caused by the fact that an input stream and random access file do not have a common interface that define these methods.

Author:
Robert van Loenhout

Constructor Summary
ReadWrapper(InputStream stream)
          Creates a new ReadWrapper that internally contains an input stream.
ReadWrapper(RandomAccessFile raf)
          Creates a new ReadWrapper that internally contains a random access file.
 
Method Summary
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadWrapper

public ReadWrapper(InputStream stream)
Creates a new ReadWrapper that internally contains an input stream.

Parameters:
stream - input stream

ReadWrapper

public ReadWrapper(RandomAccessFile raf)
Creates a new ReadWrapper that internally contains a random access file.

Parameters:
raf - random access file
Method Detail

read

public int read(byte[] b)
         throws IOException
Throws:
IOException
See Also:
InputStream.read(byte[]), RandomAccessFile.read(byte[])

read

public int read()
         throws IOException
Throws:
IOException
See Also:
InputStream.read(), RandomAccessFile.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Throws:
IOException
See Also:
InputStream.read(byte[], int, int), RandomAccessFile.read(byte[], int, int)