The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Hey! It's even simpler!

Posted by Eduardo on October 29, 2001 at 12:16 AM

Chin, I hope the date is worth it! LOL
Anyway, my program below reads the file. No problem. The question is, how to call the events inside my class Restart?
In another word, the strings read are going to be command lines inside my class.
Do you have a clue about how to solve it?
Thanks, again!

Eduardo

PS: you hava a date at midnight? Are you in California, or something, then? LOL LOL

public class ReadText {
static LinkedList list;
static LinkedList list1;

public ReadText(){}

public static void PrintText (DataInputStream in) {
try {
list = new LinkedList();
String s;
while((s = in.readLine()) != null)
list.addFirst(s);
for(int i = 0; i < list.size(); i++)

System.out.println(list.get(i));
} catch(FileNotFoundException e) {
System.err.println("File not found");
} catch(IOException e) {
System.err.println("IO error");
}
}

static LinkedList VText () {

LinkedList List1 = new LinkedList(list);
// if(List1 != null)
// System.out.println("bilubilu");
return List1;
}

public static void main(String args[]) throws IOException {
try{

DataInputStream in =
new DataInputStream(
new BufferedInputStream(
new FileInputStream("examples.txt")));

PrintText(in);
VText();
} catch(FileNotFoundException e) {
System.err.println("File not found");
} catch(IOException e) {
System.err.println("IO error");
}
}
}



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us