From: Anabolik on
How to return to the begin of InputStream after reading this file?
From: Lothar Kimmeringer on
Anabolik wrote:

> How to return to the begin of InputStream after reading this file?

use a BufferedInputStream with mark and reset or just reopen
the FileInputStream. If you need to access the file in a
"random" (non-sequential) way, you can use RandomAccessFile
http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html
and call seek(0)


Regards, Lothar
--
Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
From: Arne Vajhøj on
Anabolik wrote:
> How to return to the begin of InputStream after reading this file?

Close and reopen the file.

Arne
From: Arne Vajhøj on
Lothar Kimmeringer wrote:
> Anabolik wrote:
>> How to return to the begin of InputStream after reading this file?
>
> use a BufferedInputStream with mark and reset or just reopen
> the FileInputStream. If you need to access the file in a
> "random" (non-sequential) way, you can use RandomAccessFile
> http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html
> and call seek(0)

I would not rely on mark reset.

The docs for the marklimit method does not give a comfortable
feeling.

Arne
From: Lothar Kimmeringer on
Arne Vajh�j wrote:

> Lothar Kimmeringer wrote:
>> Anabolik wrote:
>>> How to return to the begin of InputStream after reading this file?
>>
>> use a BufferedInputStream with mark and reset [...]
>
> I would not rely on mark reset.
>
> The docs for the marklimit method does not give a comfortable
> feeling.

You need to specify the maximum number of bytes you want to
be able to go back, that's the reason why I gave alternative
ways to solve that.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!