com.amazon.carbonado.spi
Class RAFInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.amazon.carbonado.spi.RAFInputStream
All Implemented Interfaces:
Closeable

public class RAFInputStream
extends InputStream

InputStream that wraps a RandomAccessFile. A stream can be obtained for a RandomAccessFile by getting the file descriptor and creating a FileInputStream on it. Problem is that FileInputStream has a finalizer that closes the RandomAccessFile.

Author:
Brian S O'Neill

Constructor Summary
RAFInputStream(RandomAccessFile raf)
           
 
Method Summary
 void close()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int offset, int length)
           
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RAFInputStream

public RAFInputStream(RandomAccessFile raf)
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int offset,
                int length)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

close

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


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.