[ 
https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jukka Zitting updated JCR-1395:
-------------------------------

    Attachment: io.patch

Attached is a quick example patch (io.patch) I put together based mostly on 
searching for InputStream use within jackrabbit-core. It should illustrate the 
kinds of benefits we'd see with code-io.

> I think in general we should keep the number of dependencies as low as 
> possible, but if there is a
> significant amount of code or complexity that we can remove from 
> jackrabbit-core then I think we should do it.

Agreed. Commons IO is probably a borderline case in that we can well live 
without it, but on the other hand it's relatively small jar (about 100kB) and 
has no transitive dependencies, so the drawbacks aren't that bad.

> What kind of utilities are there that you think are useful?

Some examples:

1) We have a number of places where we copy streams around using a loop with a 
temporary buffer. IOUtils.copy() could do such looping and low level buffering 
for us.

2) We have quite a lot of code that manages temporary files for spooling 
streams. DeferredFileOutputStream is a perfect utility class for such needs.

3) In a number of places we count the length of a stream. CountingInputStream 
and CountingOutputStream could do that for us.

4) Even though I personally don't like the idiom "if (stream != null) { try { 
stream.close(); } catch (IOException e) { } }" (I'd rather do just 
"stream.close()" and deal with any exceptions), it is quite widely used within 
Jackrabbit. IOUtils.closeQuietly(stream) does the same thing.

5) The AutoCloseInputStream class would help us make sure that all streams we 
pass to a client will be properly closed when fully read or no longer used.


> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with 
> files and streams. Many of those utilities would be quite useful in 
> Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to 
> jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to