public void reset() {
        try {
            // reseting non cached byte stream
            if (byteArrayInputStream != null) {
                byteArrayInputStream.reset();
            }
            // reseting cached byte stream
            if (fileInputStream != null) {
                fileInputStream.close();
                fileInputStream = null;
                fileInputStream = new FileInputStream(tempFile);
            }
        } catch (IOException e) {
            logger.log(Level.FINE, "Error closing file streams.", e);
        }
    }