InputStream & StreamTokenizer problem

I have a ZipInputStream that contains a text header and then some binary image data. First I create a StreamTokenizer and then I read the text header. Everything works great so far. The problems begin when I reach the binary data. All I get when I try to read from the input stream again is zeroes. I don't think the problem has to do with the binary data, I tried to read some text at the end of the header from the input stream which also gave only zeroes. Is it not possible to read from the input stream after creating a Tokenizer from it?
labattiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

labattiAuthor Commented:
Oh, I forgot... It's JDK 1.2.2 on WinNT
0
heyhey_Commented:
post your code.
note that it if you wrap some InputStream in some other (Data)InputStream, it is not safe to read from the underlying Stream, because the wrapper probably contains cached information.
0
sgomsCommented:
post ur code.
How do u tokenize the stream?
-sgoms
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

labattiAuthor Commented:
Hmm, I *have* wraped the InputStream. What if I set the wrapers to null when I'm done with them?

/labatti

InputStream is = new GZIPInputStream(url.openConnection().getInputStream());

InputStreamReader isr = new InputStreamReader(is);
Reader r = new BufferedReader(isr);

StreamTokenizer tokenizer = new StreamTokenizer(r);
tokenizer.nextToken();

// A lot of text is read here
//  |
//  |
// End of reading text
 
// Here I'd like to read binary data from the
// input stream again.

byte[] b = new byte[sizeOfImage];
is.read(b);

0
heyhey_Commented:
>> What if I set the wrapers to null when I'm done with them?


won't work.
StreamTokenizer reads and caches some of the information ...
you'd better read only from the InputStream and parse everything yourself.
0
sgomsCommented:
heyhey is right.
parse the text urself.
-sgoms
0
labattiAuthor Commented:
Ok, thanks!

/labatti
0
heyhey_Commented:
so - answer ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
labattiAuthor Commented:
=)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.