org.shiftone.jrat.util.io
Class OpenInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.shiftone.jrat.util.io.proxy.ProxyInputStream
          extended by org.shiftone.jrat.util.io.OpenInputStream
All Implemented Interfaces:
java.io.Closeable

public class OpenInputStream
extends ProxyInputStream

Class OpenInputStream wrapps/proxies to a real InputStream and prevents the caller from closing the underlying input stream. This is useful when reading chunks from a ZipInputStream passing the archive entry inputStreams to code that calls close(). This would typically close the entire ZipInputStream, which would prevent any other archive entries from being read.

Author:
jeff@shiftone.org (Jeff Drost)

Constructor Summary
OpenInputStream(java.io.InputStream inputStream)
           
 
Method Summary
 void assertOpen()
           
 void close()
          Method close does not call close() on the underlying input stream.
protected  java.io.InputStream getTarget()
           
 
Methods inherited from class org.shiftone.jrat.util.io.proxy.ProxyInputStream
available, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenInputStream

public OpenInputStream(java.io.InputStream inputStream)
Method Detail

getTarget

protected java.io.InputStream getTarget()
                                 throws java.io.IOException
Specified by:
getTarget in class ProxyInputStream
Throws:
java.io.IOException

assertOpen

public void assertOpen()
                throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Method close does not call close() on the underlying input stream. It set's a flag that is used assertions in the read methods of this class.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class ProxyInputStream
Throws:
java.io.IOException