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.

Results 1 to 5 of 5

Thread: regarding file

  1. #1
    Member
    Join Date
    Oct 2013
    Location
    india
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default regarding file

    i want to read a file from bottom to top with out using any temporary storage


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: regarding file

    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!

  3. #3
    Member
    Join Date
    Apr 2012
    Posts
    160
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Default Re: regarding file

    This can be done using Java's RandomAccessFile and File classes with some clever usage of the methods provided.

  4. #4
    Member
    Join Date
    Oct 2013
    Location
    india
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: regarding file

    thanku

    --- Update ---

    but i am unable to read the file from last directly it's giving a number

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: regarding file

    it's giving a number
    Please post the code and post what is being read by the program.

    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.

Similar Threads

  1. Created a Random Access File that saves gibberish to a text file
    By Deprogrammer in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 21st, 2012, 11:45 AM
  2. Run a jar file inside a batch file with Windows 7 Task schduler
    By kingnachi in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 15th, 2012, 09:20 AM
  3. solaris machine /tmp folder, File.exists() cant see the existing file.
    By aragorn1905 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: December 27th, 2011, 09:41 AM
  4. insert(embed) a file object (.txt file) in MS excel sheet using java.
    By jyoti.dce in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 12th, 2010, 08:16 AM
  5. Replies: 8
    Last Post: January 6th, 2010, 09:59 AM