net.i2p.util
Class LookaheadInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by net.i2p.util.LookaheadInputStream
All Implemented Interfaces:
java.io.Closeable

public class LookaheadInputStream
extends java.io.FilterInputStream

Simple lookahead buffer to keep the last K bytes in reserve, configured to easily be reused. Currently only used by the ResettableGZIPInputStream


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LookaheadInputStream(int lookaheadSize)
           
 
Method Summary
 boolean getEOFReached()
           
 byte[] getFooter()
          grab the lookahead footer
 void initialize(java.io.InputStream src)
           
static void main(java.lang.String[] args)
           
 int read()
           
 int read(byte[] buf)
           
 int read(byte[] buf, int off, int len)
           
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookaheadInputStream

public LookaheadInputStream(int lookaheadSize)
Method Detail

getEOFReached

public boolean getEOFReached()

initialize

public void initialize(java.io.InputStream src)
                throws java.io.IOException
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

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

read

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

getFooter

public byte[] getFooter()
grab the lookahead footer


main

public static void main(java.lang.String[] args)