com.gc.iotools.stream.is
Class FileBufferedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.gc.iotools.stream.is.FileBufferedInputStream
All Implemented Interfaces:
Closeable

Deprecated.

@Deprecated
public class FileBufferedInputStream
extends InputStream

A FileBufferedInputStream adds functionality to another input stream namely, the ability to buffer the input and to support the mark and reset methods.

It is very similar to java.io.BufferInputStream but the buffer is kept on disk instead of memory. This is for supporting mark and reset over a large amount of data where a standard BufferInputStream takes too much memory.

It also adds the functionality of marking an InputStream without specifying a mark length, thus allowing a reset after an indefinite length of bytes has been read. Check mark for details.

It's best used when a large sequential read of an InputStream has to be performed and then the content of the stream must be available again. Since it's disk based performances of reset method are low. When frequent reset are needed a cache in memory should be used to speed up the process.

Since:
1.0.9
Author:
dvd.smnt
See Also:
BufferedInputStream, RandomAccessInputSteam

Constructor Summary
FileBufferedInputStream(InputStream source)
          Deprecated. Creates a FileBufferedInputStream and saves its argument, the input stream source for later use.
 
Method Summary
 int available()
          Deprecated.  
 void close()
          Deprecated. Closes the underlying InputStream and cleans up temporary files eventually created.
protected  void finalize()
          Deprecated.  
 void mark(int markLimit)
          Deprecated.  Marks the current position in this input stream.
 boolean markSupported()
          Deprecated. Tests if this input stream supports the mark and reset methods.
 int read()
          Deprecated. See the general contract of the read method of InputStream.
 int read(byte[] b, int off, int len)
          Deprecated.  
 void reset()
          Deprecated.  
 long skip(long n)
          Deprecated.  
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileBufferedInputStream

public FileBufferedInputStream(InputStream source)
Deprecated. 
Creates a FileBufferedInputStream and saves its argument, the input stream source for later use.

Parameters:
source - the underlying input stream.
Method Detail

available

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

close

public void close()
           throws IOException
Deprecated. 
Closes the underlying InputStream and cleans up temporary files eventually created.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException - if an I/O error occurs.
See Also:
InputStream.close()

mark

public void mark(int markLimit)
Deprecated. 

Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

This method extends the original behavior of the class InputStream allowing to use indefinite marking.

Overrides:
mark in class InputStream
Parameters:
markLimit - the maximum limit of bytes that can be read before the mark position becomes invalid. If negative allows indefinite marking (the mark never becomes invalid).
See Also:
InputStream.reset()

markSupported

public boolean markSupported()
Deprecated. 
Tests if this input stream supports the mark and reset methods.

Overrides:
markSupported in class InputStream
Returns:
Always return true for this class.
See Also:
InputStream.markSupported()

read

public int read()
         throws IOException
Deprecated. 
See the general contract of the read method of InputStream.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.
See Also:
InputStream.read()

read

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

reset

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

skip

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

finalize

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


Copyright © 2008-2009. All Rights Reserved.