Reading string from file timed
So I want to make a file reader/ buffered reader that reads a new line of the textfile, lets say every 30 second.
Like it reads the first line, waiting 30 seconds, read the next line and so one. Im thinking it might come in handy using tread.sleep()
I've searched but can't seem to find an example
Hope you guys can help me
View Answers
February 27, 2012 at 11:18 AM
import java.io.*;
class ReadFileWithTime
{
public static void main(String[] args)
{
try{
FileReader fr=new FileReader("C:/data.txt");
BufferedReader br=new BufferedReader(fr);
String str="";
while((str=br.readLine())!=null){
System.out.println(str);
Thread.sleep(30000);
}
}
catch(Exception e){
System.out.println(e);
}
}
}
Ads
Related Tutorials/Questions & Answers:
Reading string from file timed
Reading string from file timed So I want to make a
file reader/ buffered reader that reads a new line of the textfile, lets say every 30 second.
Like it reads the first line, waiting 30 seconds, read the next line and so one
Reading a file from Jar JAVA
Reading a
file from Jar JAVA I have added one excel sheet into a jar
file.
can anybody tell me how i can read that
file.
actually when i am running code
from eclipse i able to read it but when i am adding that jar
file
Advertisements
Reading a file from Jar JAVA
Reading a
file from Jar JAVA I have added one excel sheet into a jar
file.
can anybody tell me how i can read that
file.
actually when i am running code
from eclipse i able to read it but when i am adding that jar
file
Writing to and reading from a binary file in java.
Writing to and
reading from a binary
file in java. I have written... the binary
file from another program as follows:
m_dis = new DataInputStream... work, but the records obtained after
reading the binary
file are much less than
jar file not reading input from serial port
jar
file not
reading input
from serial port i used a coding for getting data
from serial port. JOptionbox with "port not found" message is shown when i execute thru jar
file. but when i execute thru netbeans, data is received
jar file not reading input from serial port
jar
file not
reading input
from serial port i used a coding for getting data
from serial port. JOptionbox with "port not found" message is shown when i execute thru jar
file. but when i execute thru netbeans, data is received
reading data from excel file and plotting graph
reading data
from excel
file and plotting graph I am doing a project using NetBeans in which i have to take input an excel
file and then using... at the same time
from one excel
file using different columns..how can i do that?
waiting
how to write to file from string in Java
how to write to
file from string in Java Hi,
Please any one help me for how to write to
file from string in Java. I am beginner in Java programming.
Thanks,
Hi,
Are you eager to learn how to write to
file from
Java Write To File From String
Java Write To
File From String
In this tutorial you will learn how to write to
file from string.
Write to
file from string using java at first we will have... you how to write a
file from string";
File file = null
Reading Value From console
Reading Value
From console In case of
String data Type readLine method of DataInputStream class
read complete line of the given
string but the next method of Scanner
class doesn't read the complete line of
String. why
Reading Value From console
Reading Value
From console In case of
String data Type readLine method of DataInputStream class
read complete line of the given
string but the next method of Scanner
class doesn't read the complete line of
String. why
reading from pdf
reading from pdf how can i read specific words
from pdf
file?
Java Read pdf
file
import java.io.*;
import java.util.*;
import... static void main(
String[] args) throws IOException {
try
Reading a text file in java
Reading a text
file in java What is the code for
Reading a text
file... in java.io.* package for
reading and writing to a
file in Java.
To learn more about
reading text
file in Java see the tutorial Read
File in Java.
Thanks
External file reading in jsp
External
file reading in jsp i have written a jsp page(ReadExt.jsp) in my application which reads a text
file content
from a system...
file. It uses BufferedReader class to read that particular
file.
<%@ page
External file reading in jsp
External
file reading in jsp i have written a jsp page(ReadExt.jsp) in my application
which reads a text
file content
from a system...; The given code reads the given
file. It uses BufferedReader class to read
Thread for reading txt file
Thread for
reading txt file how to use 3 thread to read 3 txt
file?
To create three threads for
reading the
file and three threads for getting the strings out of the queue and printing them.
thanks
Problem reading word file
Problem
reading word file Deepak you provide me code for extarcting equation
from a word
file and also to write in a word file.But when I again want to read preveously created word
file(created by your code) it gives an error
Writing and Reading A File
and
reading data
from file for our assignment, but just stuck on how to proceed... BufferedWriter(new FileWriter(
file,true));
for (
String s : list) {
out.write(s...;To extract the data
from text
file and save it to jtable, visit the following links
Reading file into bytearrayoutputstream
(
String[] args)
{
System.out.println("Example of
Reading file into byte... input stream and byte output stream. This is and
good example of
reading file... we have used the class InputStream
for
reading the
file content into byte
Reading big file in Java
Reading big
file in Java How to read a big text
file in Java program?
Hi,
Read the complete tutorial at How to read big
file line by line in java?
Thanks
Reading an excel file into array
Reading an excel
file into array Hi,
I'm trying to read in an excel
file, search a column for containing key words (entered by a user) and then displaying the matching rows in a table. I'm fairly new to JavaScript. Can anyone
Reading Text file and storing in map
Reading Text
file and storing in map Hi
I have multiple text files. I want to read thoses files and store those records in map.
Map will be of "LinkedHashMap<
String, Map<
String, String>>" type.
Please let me know
Reading a big file effeciently
Reading a big
file effeciently How to read a large text
file quickly without memory error in Java?
What is the best method to read a big
file very efficiently?
Thanks
Hi,
Kindly check the program Java Read
File
Reading Lines from a String Using a Regular Expression
Reading Lines
from a
String Using a Regular Expression... for the best illustration of
the procedure of
reading of line
from the
file.
Program Result:
Following program takes a text
file name and reads all
the
string