org.abstracthorizon.danube.webdav.fs
Class RandomAccessFileRangeInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.abstracthorizon.danube.webdav.fs.RandomAccessFileRangeInputStream
All Implemented Interfaces:
Closeable

public class RandomAccessFileRangeInputStream
extends InputStream

Input stream that is based on RandomAccessFile and has given offset and length.

Author:
Daniel Sendula

Field Summary
protected  long initialOffset
          Initial offset
protected  long len
          Number of bytes that can be read
protected  long mark
          Mark pointer
protected  long markLen
          Mark length
protected  RandomAccessFile raf
          Random access file reference
 
Constructor Summary
RandomAccessFileRangeInputStream(File file, long from, long length)
          Constructor
 
Method Summary
 void close()
           
 void mark(int i)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] buf, int from, int length)
           
 void reset()
           
 long skip(long l)
           
 
Methods inherited from class java.io.InputStream
available, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

raf

protected RandomAccessFile raf
Random access file reference


len

protected long len
Number of bytes that can be read


initialOffset

protected long initialOffset
Initial offset


mark

protected long mark
Mark pointer


markLen

protected long markLen
Mark length

Constructor Detail

RandomAccessFileRangeInputStream

public RandomAccessFileRangeInputStream(File file,
                                        long from,
                                        long length)
                                 throws IOException
Constructor

Parameters:
file - a file
from - initial offset
length - length
Throws:
IOException - thrown from RandomAccessFile
Method Detail

read

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

read

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

skip

public long skip(long l)
          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

mark

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

reset

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream


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