com.partnersoft.io.vfs
Class VfsRandomAccessInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.partnersoft.io.vfs.VfsRandomAccessInputStream
All Implemented Interfaces:
java.io.Closeable

public class VfsRandomAccessInputStream
extends java.io.InputStream

A wrapper implementation of InputStream that forwards all I/O to an enclosed VfsRandomAccess object. Useful for VfsImplementations where there are no existing InputStream implementations and you just want to implement the VfsRandomAccess and get on with life.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
VfsRandomAccessInputStream(VfsRandomAccess randy, boolean closeOnClose)
          Create an input stream for the given VfsRandomAccess object.
VfsRandomAccessInputStream(VfsRandomAccess randy, long length, boolean closeOnClose)
          Create an input stream for the given VfsRandomAccess object.
VfsRandomAccessInputStream(VfsRandomAccess randy, long start, long end, boolean closeOnClose)
          Create an input stream for the given VfsRandomAccess object.
 
Method Summary
 int available()
           
 void close()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 long skip(long n)
           
 java.lang.String toString()
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VfsRandomAccessInputStream

public VfsRandomAccessInputStream(VfsRandomAccess randy,
                                  boolean closeOnClose)
                           throws java.io.IOException
Create an input stream for the given VfsRandomAccess object. It will begin reading at the VfsRandomAccess' current byte position.

Throws:
java.io.IOException

VfsRandomAccessInputStream

public VfsRandomAccessInputStream(VfsRandomAccess randy,
                                  long length,
                                  boolean closeOnClose)
                           throws java.io.IOException
Create an input stream for the given VfsRandomAccess object. It will begin reading at the VfsRandomAccess' current byte position and end after the given length in bytes.

Throws:
java.io.IOException

VfsRandomAccessInputStream

public VfsRandomAccessInputStream(VfsRandomAccess randy,
                                  long start,
                                  long end,
                                  boolean closeOnClose)
                           throws java.io.IOException
Create an input stream for the given VfsRandomAccess object. It will begin reading at the given start position and end at the given end position.

Throws:
java.io.IOException
Method Detail

read

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

read

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

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

skip

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

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

close

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object