com.liferay.portal.kernel.util
Class RandomAccessInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.liferay.portal.kernel.util.RandomAccessInputStream
All Implemented Interfaces:
java.io.Closeable

public class RandomAccessInputStream
extends java.io.InputStream

This class enables any InputStream to be seekable by caching its data in a temporary RandomAccessFile.

Author:
Juan González

Constructor Summary
RandomAccessInputStream(java.io.InputStream inputStream)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 void mark(int readLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] bytes, int offset, int length)
           
protected  long readUntil(long position)
           
 void reset()
           
 void seek(long position)
           
 
Methods inherited from class java.io.InputStream
available, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomAccessInputStream

public RandomAccessInputStream(java.io.InputStream inputStream)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

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

mark

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream

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[] bytes,
                int offset,
                int length)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

reset

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

seek

public void seek(long position)
          throws java.io.IOException
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

readUntil

protected long readUntil(long position)
                  throws java.io.IOException
Throws:
java.io.IOException