org.apache.hadoop.hbase.io
Class BlockFSInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.hadoop.fs.FSInputStream
          extended by org.apache.hadoop.hbase.io.BlockFSInputStream
All Implemented Interfaces:
Closeable, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.Seekable

public class BlockFSInputStream
extends org.apache.hadoop.fs.FSInputStream

An implementation of FSInputStream that reads the stream in blocks of a fixed, configurable size. The blocks are stored in a memory-sensitive cache.


Constructor Summary
BlockFSInputStream(InputStream in, long fileLength, int blockSize)
           
 
Method Summary
 int available()
           
 void close()
           
 long getPos()
           
 void mark(int readLimit)
           
 boolean markSupported()
          We don't support marks.
 int read()
           
 int read(byte[] buf, int off, int len)
           
 void reset()
           
 void seek(long targetPos)
           
 boolean seekToNewSource(long targetPos)
           
 
Methods inherited from class org.apache.hadoop.fs.FSInputStream
read, readFully, readFully
 
Methods inherited from class java.io.InputStream
read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockFSInputStream

public BlockFSInputStream(InputStream in,
                          long fileLength,
                          int blockSize)
Parameters:
in -
fileLength -
blockSize - the size of each block in bytes.
Method Detail

getPos

public long getPos()
Specified by:
getPos in interface org.apache.hadoop.fs.Seekable
Specified by:
getPos in class org.apache.hadoop.fs.FSInputStream

available

public int available()
Overrides:
available in class InputStream

seek

public void seek(long targetPos)
          throws IOException
Specified by:
seek in interface org.apache.hadoop.fs.Seekable
Specified by:
seek in class org.apache.hadoop.fs.FSInputStream
Throws:
IOException

seekToNewSource

public boolean seekToNewSource(long targetPos)
                        throws IOException
Specified by:
seekToNewSource in interface org.apache.hadoop.fs.Seekable
Specified by:
seekToNewSource in class org.apache.hadoop.fs.FSInputStream
Throws:
IOException

read

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

read

public int read(byte[] buf,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

close

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

markSupported

public boolean markSupported()
We don't support marks.

Overrides:
markSupported in class InputStream

mark

public void mark(int readLimit)
Overrides:
mark in class InputStream

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException


Copyright © 2008 The Apache Software Foundation