i want to read a file from bottom to top with out using any temporary storage
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
i want to read a file from bottom to top with out using any temporary storage
That will be very expensive. About the only way to do this would be to read the entire file and count the number of lines. Lets imagine there are 5 lines. Then read the entire file again up to line 5. Read the entire file again up to line 4. Read the entire file again up to line 3. etc.
Improving the world one idiot at a time!
This can be done using Java's RandomAccessFile and File classes with some clever usage of the methods provided.
thanku
--- Update ---
but i am unable to read the file from last directly it's giving a number
Please post the code and post what is being read by the program.it's giving a number
Everything on a computer is a number. Some numbers represent characters and can be viewed as characters by casting them or converting them using some class's constructor or method.
If you don't understand my answer, don't ignore it, ask a question.