[
https://issues.apache.org/jira/browse/IO-92?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Niall Pemberton resolved IO-92.
-------------------------------
Resolution: Won't Fix
"It's probably the same, but how many objects are you creating your way?"
Three instead of one - so not much difference.
"How many lines of code are you writing?"
Either one or two. But the real saving is in not having to support and maintain
an addtional implementation in Commons IO that basically duplicates existing
behaviour provided by the JDK. Thats just a complete waste of effort and code
bloat IMO.
"BTW, DeferredOutputStream is a decorator as well, but: "
"1 - it's "dangerous" because if you don't reach the threshold value and close
the stream, you'll lose everything"
No its not - you just call the getData() method and you can get the bytes.
"2- once the threshold has been reached it behaves exacly the same as the
default implementations."
Don't understand this.
Anyway since theres an easy solution that already exists provided by the JDK to
do what you want then I'm closing this as WONTFIX
> Add DeferredPeriodicOutputStream
> --------------------------------
>
> Key: IO-92
> URL: https://issues.apache.org/jira/browse/IO-92
> Project: Commons IO
> Issue Type: New Feature
> Components: Streams/Writers
> Environment: Windows XP SP2, jdk 1.5
> Reporter: Michele Mazzucco
> Fix For: 1.4
>
> Attachments: DeferredPeriodicOutputStream.java,
> DeferredPeriodicOutputStream.java, DeferredPeriodicOutputStream.java,
> DeferredPeriodicOutputStreamTest.java, DeferredPeriodicOutputStreamTest.java,
> DeferredPeriodicOutputStreamTest.java
>
>
> 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. This new 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.
> - It implements the java.io.DataOutput interface, that is, it provides
> utility methods to write all primitive types (e.g. short, byte, char, int,
> float, long, double and String in different formats)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.