jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Retrieving binary content
Date Tue, 28 Nov 2006 09:44:10 GMT

On 11/28/06, Ted Roeloffzen <ted.roeloffzen@gmail.com> wrote:
> And how do I read the actual data with that inputstream?

It's a standard java.io.InputStream. See the javadocs for example at

A common pattern I use when processing stream data is:

    InputStream data = ...;
    try {
        byte[] buffer = new byte[BUFFER_SIZE];
        for (int n = data.read(buffer); n != -1; n = data.read(buffer)) {
            // process n bytes of data in buffer
    } finally {

Note especially the finally branch used to guarantee that the stream
gets closed even if an error occurs.

> Sorry if this is a stupid question, but i'm not that experienced.

No problem, stupid is the one who doesn't ask. :-)


Jukka Zitting

View raw message