org.entityfs.util.io
Class RandomAccessToOutputStreamAdapter

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.entityfs.util.io.RandomAccessToOutputStreamAdapter
All Implemented Interfaces:
Closeable, Flushable

public class RandomAccessToOutputStreamAdapter
extends FilterOutputStream

This adapter treats a RandomAccess as an OutputStream .

Since:
1.0
Author:
Karl Gustafsson

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
RandomAccessToOutputStreamAdapter(RandomAccess ra)
          Create an adapter between a RandomAccess and an OutputStream.
RandomAccessToOutputStreamAdapter(RandomAccess ra, boolean closeRandomAccessWhenClosingStream)
          Create an adapter between a RandomAccess and an OutputStream.
 
Method Summary
 void close()
           
 void flush()
           
 void write(byte[] barr)
           
 void write(byte[] barr, 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

RandomAccessToOutputStreamAdapter

public RandomAccessToOutputStreamAdapter(RandomAccess ra)
Create an adapter between a RandomAccess and an OutputStream.

When this adapter is closed, it closes the underlying RandomAccess object. See RandomAccessToOutputStreamAdapter(RandomAccess, boolean)

Parameters:
ra - The RandomAccess to adapt.

RandomAccessToOutputStreamAdapter

public RandomAccessToOutputStreamAdapter(RandomAccess ra,
                                         boolean closeRandomAccessWhenClosingStream)
Create an adapter between a RandomAccess and an OutputStream.

Parameters:
ra - The RandomAccess to adapt.
closeRandomAccessWhenClosingStream - Should the RandomAccess be closed when this stream is closed?
Method Detail

write

public void write(byte[] barr)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] barr,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class FilterOutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class FilterOutputStream
Throws:
IOException