how to find out the end of the file in java
hi friends,
I am reading a file char by char. So how can I check for end of the file. I va a integer of the character and a string which has hex value of the character.
but when I execute the pgm, it shows out of memory error. overflow of the heap.
can anyone help?
thanks in advance...
bye
> Use a BufferedReader and readLine if you want to read
> lines. readLine will return null when there are no
> more lines.
>
> Kaj
ya that i know. but i need to read each char and display each char in hex form. and wen the end of line happens it should go to the new line.
can we do that in java?
regards.
Just read a line from the file. Iterate over all characters in the line, and print them, then read the next line. (So you should still use a BufferedReader or you are reading text, and BufferedInputStream if you are reading binary data)Kaj
kajbja at 2007-7-11 15:29:16 >

> > There is no "type of file". It's all zeroes and
> ones.
>
> thing is am wrintin a file. I want to set the
> type(extension) to be .iso. how can i do that?
If you want to make the extension ".iso" then just end the file name with ".iso".
If you want to make the "type" iso, so that it can be manipulated by an iso application or whatever, then you have to make sure the bytes you write are of the proper format.
As already stated: Files don't have a type.
jverda at 2007-7-11 15:29:16 >

> If you want to make the "type" iso, so that it can be
> manipulated by an iso application or whatever, then
> you have to make sure the bytes you write are of the
> proper format.
>
> As already stated: Files don't have a type.
thanks buddy...
a want to create an iso type. now let me try for it....
once again thnx...
bye.
regards.