Solved

File Manipulation

Posted on 2004-09-29
3
175 Views
Last Modified: 2010-03-31
OK,

I've written a program and here is what it does:

1. Every 3 seconds, the prog checks to see if a files lastModified time has changed.  
2. If it has, the prog then reads each line (the line is a list of parameters for another class)
3. Launches another class in a new thread for each line and processes the parameters
4. deletes the original file (after all lines have been read and the InputStreamReader is closed)
5. recreates the file for future entries (because I don't want to re-process those lines already processed).
6. sets the new files lastModified time to the last captured lastModified time

The future entries will be written to the file using asp.

Is there a better way of doing this???  If you would like to see my code, please let me know.  It's quite lengthy.  If there is a better way of doing this, examples or links to examples would be great.

Thanks

DDS
0
Comment
Question by:dds110
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
TrekkyLeaper earned 250 total points
ID: 12186669
I can't really give you any examples, but I do have a couple suggestions.

1) You might want to consider using network sockets feed the ASP output into the java program. Then you just use a buffered reader (or similar) to read lines from the socket.

2) If possible, you could pipe the output of the ASP file into stdin for the Java program. This would be similar to 1 except that you'd be using System.in instead of an input stream from the socket.
0
 
LVL 8

Author Comment

by:dds110
ID: 12190087
Sounds interesting.  I think I'll give it a go.  But I want to see if anyone else chimes in before I award points.
0
 
LVL 5

Expert Comment

by:TrekkyLeaper
ID: 12199573
I guess you got one of those to work? Cool. Thanks for the points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now