commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Mazzucco <Michele.Mazzu...@ncl.ac.uk>
Subject [io] new ThresholdingOutputStream implementation
Date Sat, 09 Sep 2006 19:18:37 GMT
Hi all,

I've extended the ThresholdingOutputStream class with a new class which
behaves different from DeferredFileOutputStream:
- when the stream is closed, the content stored in memory is *always*
flushed to disk (in DeferredFileOutputStream, instead, if the treshold
is not reached data is lost)
- DeferredFileOutputStream maintains data in memory only until the
treshold value has been reached, then it immediately writes every byte
to disk. Mine implementation, instead, caches treshold bytes in memory,
and every time that value is reached (that is, treshold, 2 * threshold,
etc), it flushes data to disk. In other words it acts as a cache.

Please find attached the class together with the unit test.



Best regards,
Michele

Mime
View raw message