• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically reading a file

 
mayank gupta
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a shell script which populates records in a flat file. I have a java program that has to read in those records and process them.

File file = new File("test");
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
String cdr = null;

try {
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);

while (dis.available() != 0) {
cdr = dis.readLine();
(new Thread(new CreditCalculator(cdr))).start();
//thread1.start();
System.out.println("One thread started "+cdr);
}System.out.println("Ended while loop\n");
 
mayank gupta
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry i sent it by mistake before i could complete the post.

I have a shell script which populates records in a flat file. I have a java program that has to read in those records and process them.

File file = new File("test");
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
String cdr = null;

try {
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);

while (dis.available() != 0) {
cdr = dis.readLine();
(new Thread(new CreditCalculator(cdr))).start();
}

My flat file gets populated on and off but the issue is that once i run the class it does not read the updated flat file. Will I have to load the file again? How can I do it?

Please help.

Thank You.
Mayank.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Part of the problem may be that AvailableDoesntDoWhatYouThinkItDoes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic