Package nl.vpro.util

Class FileCachingInputStream

java.lang.Object
java.io.InputStream
nl.vpro.util.FileCachingInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class FileCachingInputStream extends InputStream

When wrapping this around your inputstream, it will be read as fast a possible, but you can consume from it slower.

It will first buffer to an internal byte array (if the initial buffer size > 0, defaults to 2048). If that is too small it will buffer the result to a temporary file.

Use this if you want to consume an inputstream as fast as possible, while handing it at a slower pace. The cost is the creation of the temporary file.

Since:
0.50
Author:
Michiel Meeuwissen