From: bugbear on
I've looked in the standard libraries, and Apache.

I want a Reader (or Stream) that provides
a view onto PART of an existing Reader (or Stream)
defined by an offset and a size.

Such an implementation would be very useful to me,
e.g. for decoding some JPEG data (using a standard JPEG stream
decoder) where the JPEG is actually held
as a sub-set of some other file (e.g. the thumbnail
for a giant TIFF image).

Does anyone know of such a class/library?

BugBear
From: Lew on
bugbear wrote:
> I've looked in the standard libraries, and Apache.
>
> I want a Reader (or Stream) that provides
> a view onto PART of an existing Reader (or Stream)
> defined by an offset and a size.
>
> Such an implementation would be very useful to me,
> e.g. for decoding some JPEG data (using a standard JPEG stream
> decoder) where the JPEG is actually held
> as a sub-set of some other file (e.g. the thumbnail
> for a giant TIFF image).
>

You aren't going to use a Reader for image data.

> Does anyone know of such a class/library?
>

If the TIFF is stored in a file you can use
<http://java.sun.com/javase/6/docs/api/java/io/RandomAccessFile.html>

Any InputStream that supports mark() and reset() should do what you
want.
<http://java.sun.com/javase/6/docs/api/java/io/
InputStream.html#mark(int)>
<http://java.sun.com/javase/6/docs/api/java/io/
InputStream.html#reset()>

such as
<http://java.sun.com/javase/6/docs/api/java/io/FileInputStream.html>

You can get around some of the inefficiency of those by judicious use
of
<http://java.sun.com/javase/6/docs/api/java/io/
BufferedInputStream.html>

I wouldn't model what you're doing as a Stream, but as a TIFF
structure read from a Stream in its entirety, then broken into
appropriate pieces in memory.

--
Lew
From: John B. Matthews on
In article <w7idnX-dP7qOS9PRnZ2dnUVZ7o2dnZ2d(a)brightview.co.uk>,
bugbear <bugbear(a)trim_papermule.co.uk_trim> wrote:

> I've looked in the standard libraries, and Apache.
>
> I want a Reader (or Stream) that provides a view onto PART of
> an existing Reader (or Stream) defined by an offset and a
> size.
>
> Such an implementation would be very useful to me, e.g. for
> decoding some JPEG data (using a standard JPEG stream
> decoder) where the JPEG is actually held as a sub-set of some
> other file (e.g. the thumbnail for a giant TIFF image).
>
> Does anyone know of such a class/library?

On a much smaller scale, I've use InputStream's mark(), reset()
and skip() methods to interpret disparate parts of a file. In
this simple example, class DumpCodes,

<http://sites.google.com/site/trashgod/edasm>

the mark is at the beginning, and the entire file is buffered;
but I wonder if you could mark() the TIFF stream at the
beginning of the JPEG thumbnail with a suitable readlimit and
then use that stream to construct a JPEGCodec.

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: markspace on
bugbear wrote:
> I've looked in the standard libraries, and Apache.
>
> I want a Reader (or Stream) that provides
> a view onto PART of an existing Reader (or Stream)
> defined by an offset and a size.
>
> Such an implementation would be very useful to me,
> e.g. for decoding some JPEG data (using a standard JPEG stream
> decoder) where the JPEG is actually held
> as a sub-set of some other file (e.g. the thumbnail
> for a giant TIFF image).
>
> Does anyone know of such a class/library?


We had a big discussion about this before. Basically, the class names
in Jar files are stored as plain text. You can search for them using
any standard search tool. Windows search should work (must check the
"search inside files" button), grep, find, etc.

Linkage:

<http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/afd1434312d66b43/e82b4c79d0cab475?lnk=gst&q=grep+jar+class#e82b4c79d0cab475>
From: John B. Matthews on
In article <i2n2cf$1of$1(a)news.eternal-september.org>,
markspace <nospam(a)nowhere.com> wrote:

> bugbear wrote:
> > I've looked in the standard libraries, and Apache.
> >
> > I want a Reader (or Stream) that provides a view onto PART
> > of an existing Reader (or Stream) defined by an offset and
> > a size.
> >
> > Such an implementation would be very useful to me, e.g. for
> > decoding some JPEG data (using a standard JPEG stream
> > decoder) where the JPEG is actually held as a sub-set of
> > some other file (e.g. the thumbnail for a giant TIFF
> > image).
> >
> > Does anyone know of such a class/library?
>
> We had a big discussion about this before. Basically, the
> class names in Jar files are stored as plain text. You can
> search for them using any standard search tool. Windows
> search should work (must check the "search inside files"
> button), grep, find, etc.
>
> Linkage:
>
> <http://groups.google.com/group/comp.lang.java.programmer/msg/7ccbb88ac29ceb44>

This fine answer seems more apropos to this other question:-)

<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/0edbc9476c8c7e7b>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>