com.atlassian.core.util
Class ReusableBufferedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by com.atlassian.core.util.ReusableBufferedInputStream
All Implemented Interfaces:
Closeable

public class ReusableBufferedInputStream
extends BufferedInputStream

Decorated subclass of BufferedInputStream that can be read multiple times as it marks the stream with Integer.MAX_VALUE and resets the stream when close() is called.


Field Summary
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ReusableBufferedInputStream(InputStream inputStream)
           
 
Method Summary
 void close()
          Calls BufferedInputStream.reset() instead of closing the stream.
 void destroy()
          Actually closes the ReusableBufferedInputStream by calling BufferedInputStream.close().
 
Methods inherited from class java.io.BufferedInputStream
available, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReusableBufferedInputStream

public ReusableBufferedInputStream(InputStream inputStream)
Method Detail

close

public void close()
           throws IOException
Calls BufferedInputStream.reset() instead of closing the stream.

Specified by:
close in interface Closeable
Overrides:
close in class BufferedInputStream
Throws:
IOException

destroy

public void destroy()
             throws IOException
Actually closes the ReusableBufferedInputStream by calling BufferedInputStream.close().

Throws:
IOException


Copyright © 2015 Atlassian. All rights reserved.