Results 1 to 1 of 1
- 10-19-2010, 04:56 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 1
- Rep Power
- 0
BufferedReader alternative for large input
I'm busy creating a program that uses external programs. My problem is that the following code isn't efficient because it's filling my RAM and the main program is using to much cpu.
The bufferedReader reads the progress of a program mkvextract, the problem is that it outputs the same line for a long time, and the BufferedReader readline methode reads the same line over and over again.
Does anybody know a good alternative to this problem?
Java Code:Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec(extractAllTracksCommand); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = reader.readLine(); while (line != null) { if (line.contains("%")) { int beginIndex = line.indexOf(": ") + 2; int endIndex = line.indexOf("%"); int progress = Integer.parseInt(line.substring(beginIndex, endIndex)); setProgress(progress); } line = reader.readLine(); }
Similar Threads
-
alternative for ajax
By site4u in forum New To JavaReplies: 6Last Post: 04-28-2011, 01:15 PM -
Is there an alternative to OBEX?
By danielpereira in forum Advanced JavaReplies: 0Last Post: 10-17-2010, 11:36 PM -
Is EJB an alternative for JDBC?
By makpandian in forum Enterprise JavaBeans (EJB)Replies: 4Last Post: 01-06-2010, 09:14 AM -
Looking for alternative to Web Start
By SamSam in forum Advanced JavaReplies: 1Last Post: 05-06-2009, 07:19 PM -
Any Alternative to Swing?
By Niveditha in forum AWT / SwingReplies: 13Last Post: 06-27-2008, 09:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks