com.calitha.io
Class WriteWrapper

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

public class WriteWrapper
extends Object

A WriteWrapper object is used to use read and write methods on an output 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 output stream and random access file do not have a common interface that define these methods.

Author:
Robert van Loenhout

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

Constructor Detail

WriteWrapper

public WriteWrapper(OutputStream stream)
Creates a new WriteWrapper that internally contains an output stream.

Parameters:
stream - output stream

WriteWrapper

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

Parameters:
raf - random access file
Method Detail

write

public void write(byte[] b)
           throws IOException
Throws:
IOException
See Also:
OutputStream.write(byte[]), RandomAccessFile.write(byte[])

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Throws:
IOException
See Also:
OutputStream.write(byte[], int, int), RandomAccessFile.write(byte[], int, int)

write

public void write(int b)
           throws IOException
Throws:
IOException
See Also:
OutputStream.write(int), RandomAccessFile.write(int)