Results 1 to 3 of 3
  1. #1
    Farzaneh is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default Behaving text files like binary files

    Hi all,

    My program reads a text file as input. This text file is output of another program (Squid's access.log) so it isn't of my choice to choose another format.
    My program should read this file every N minutes and see if new lines is added to it,add this new information to a database. Now I store a parameter called CurLineNo and every time I read lines from the begining,ignoring them until I reach CurLineNo and after that ,processing lines and increasing CurLineNo. But this method is slow as the input file grows:(
    I want to know if there is any other way or trick that I could do it faster, similar to binary files for example.

    Thanks

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Look at the RandomAccessFile. It has methods to allow you to start reading at any point in the file.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 6
    Last Post: 08-06-2008, 01:41 PM
  2. Does OS intervene when reading Java text files
    By Tina G in forum Advanced Java
    Replies: 1
    Last Post: 04-07-2008, 02:29 PM
  3. Applet - reading text files packed into JAR file
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-08-2008, 09:15 AM
  4. Text and image files within jar files
    By erhart in forum Advanced Java
    Replies: 8
    Last Post: 01-19-2008, 04:43 AM
  5. how to convert mpeg files to .wav files
    By christina in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 04:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •