Class DoubleBufferedInputStream<I extends InputStream>

java.lang.Object
java.io.InputStream
org.bouncycastle.openpgp.api.DoubleBufferedInputStream<I>
All Implemented Interfaces:
Closeable, AutoCloseable

public class DoubleBufferedInputStream<I extends InputStream> extends InputStream
Implementation of an InputStream that double-buffers data from an underlying input stream. Upon reaching the end of the underlying data stream, the underlying data stream is automatically closed. Any exceptions while reading from the underlying input stream cause the DoubleBufferedInputStream to withhold pending data. This is done in order to minimize the risk of emitting unauthenticated plaintext, while at the same time being somewhat resource-efficient. The minimum number of bytes to withhold can be configured (BUFFER_SIZE by default).