private ByteBuffer decodeStream(Set<String> filterLimits) throws IOException {
        ByteBuffer outStream = null;

        // first try the cache
        if (decodedStream != null && filterLimits.equals(decodedStreamFilterLimits)) {
            outStream = (ByteBuffer) decodedStream.get();
        }

        // no luck in the cache, do the actual decoding
        if (outStream == null) {
            stream.rewind();
            outStream = PDFDecoder.decodeStream(this, stream, filterLimits);
            decodedStreamFilterLimits = new HashSet<String>(filterLimits);
            decodedStream = new SoftReference(outStream);
        }

        return outStream;
    }