If the file is already existing- Try using only Reading the file. Because if you open the stream for writing to the file- The contents will get erased provided you are not trying to append the contents to the file.
Mohamed Sanaulla wrote:
But I dont understand why its giving java.lang.NullPointerException at line 29.
Probably the OP not providing all the lines in the file. Next time it may be a good idea to bring up the text editor, find line 29, and tell us which line it is -- as it may not be the same if you don't provide all of the file.
Joined: Sep 06, 2007
This line has problem
The whole code:
I have a text file I want read it and show the content by byte stream
it has problem because You haven't initialized the in reference to a valid FileInputStream reference. Please note that unless you initialize the object references with valid instances/objects you cannot use those references.