Class BufferedDataFetcher

  • All Implemented Interfaces:
    DataFetcher

    public final class BufferedDataFetcher
    extends AbstractBufferedDataFetcher
    AbstractBufferedDataFetcher is a sensible base implementation of DataFetcher that uses a byte[] as buffer, while copying all bytes from an InputStream to an OutputStream by sequentially reading from the InputStream into the buffer and then writing from the buffer to the OutputStream.

    The buffer is eagerly allocated in the constructor just once and then used for every operation. A BufferedDataFetcher is therefore not threadsafe.

    After a buffer has been used, it is overwritten with zeros, to remove any buffered information from the memory.

    Since:
    4.0.0
    Author:
    Torsten Krause (tk at markenwerk dot net)