Prev: When String.hashCode() returns 0 (Was: what the benefit is byusing annotation, like "@Immutable" ?)
Next: Why do I get a null URL here?
From: markspace on 27 Jul 2010 15:03 John B. Matthews wrote: > This fine answer seems more apropos to this other question:-) Yeah, don't know what happened there. Pilot error I guess.
From: Tom Anderson on 27 Jul 2010 15:27 On Tue, 27 Jul 2010, markspace wrote: > John B. Matthews wrote: > >> This fine answer seems more apropos to this other question:-) > > Yeah, don't know what happened there. Pilot error I guess. News server bug, clearly. Never apologise, never explain. tom -- Caps lock is like cruise control for cool.
From: Tom Anderson on 27 Jul 2010 15:32 On Tue, 27 Jul 2010, 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? If i've understood you correctly, then i think this may be of use to you: http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/util/LimitedInputStream.html This is a moderately common thing to need, and since it's not in the standard library, there are dozens of other implementations of it around, mostly with the same name! It's also not hard to write if you don't want to drag in another library. You just write a FilterInputStream with a count of bytes remaining, and implement read() and read(byte[], int, int) to check the count and behave accordingly. And override the mark/reset methods to respect the count, or do nothing. tom -- Caps lock is like cruise control for cool.
From: John B. Matthews on 27 Jul 2010 16:12 In article <alpine.DEB.1.10.1007272026440.23622(a)urchin.earth.li>, Tom Anderson <twic(a)urchin.earth.li> wrote: > On Tue, 27 Jul 2010, markspace wrote: > > > John B. Matthews wrote: > > > >> This fine answer seems more apropos to this other question:-) > > > > Yeah, don't know what happened there. Pilot error I guess. > > News server bug, clearly. Never apologise, never explain. If bugbear uses it to find that LimitedInputStream is already available, then it will have been the correct answer all along! -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
From: Tom Anderson on 27 Jul 2010 16:40
On Tue, 27 Jul 2010, John B. Matthews wrote: > In article <alpine.DEB.1.10.1007272026440.23622(a)urchin.earth.li>, > Tom Anderson <twic(a)urchin.earth.li> wrote: > >> On Tue, 27 Jul 2010, markspace wrote: >> >>> John B. Matthews wrote: >>> >>>> This fine answer seems more apropos to this other question:-) >>> >>> Yeah, don't know what happened there. Pilot error I guess. >> >> News server bug, clearly. Never apologise, never explain. > > If bugbear uses it to find that LimitedInputStream is already available, > then it will have been the correct answer all along! DAMN HE'S GOOD. tom -- Safety not guaranteed. I have only done this once before. |