org.abstracthorizon.mercury.common.io
Class AdvancedFileReader

java.lang.Object
  extended by java.io.Reader
      extended by org.abstracthorizon.mercury.common.io.AdvancedFileReader
All Implemented Interfaces:
Closeable, Readable

public class AdvancedFileReader
extends Reader

File reader that can uses random access file.

Author:
Daniel Sendula

Field Summary
protected  RandomAccessFile file
          Random access file
protected  long mark
          Mark
protected  long size
          Size
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
AdvancedFileReader(File file, long from, long size)
          Constructor
 
Method Summary
 void close()
           
 void mark()
          Marks position in a file
 boolean markSupported()
           
 int read(char[] cbuf, int off, int len)
           
 boolean ready()
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.Reader
mark, read, read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected long size
Size


mark

protected long mark
Mark


file

protected RandomAccessFile file
Random access file

Constructor Detail

AdvancedFileReader

public AdvancedFileReader(File file,
                          long from,
                          long size)
                   throws IOException
Constructor

Parameters:
file - file
from - starting offset
size - size
Throws:
IOException
Method Detail

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException

close

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class Reader

mark

public void mark()
          throws IOException
Marks position in a file

Throws:
IOException

reset

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

ready

public boolean ready()
Overrides:
ready in class Reader

skip

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


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.