Solved

inputFileMsg as String object from file

Posted on 2014-02-28
2
543 Views
Last Modified: 2014-02-28
Hi,

I am going through below example

http://bethecoder.com/applications/tutorials/tools-and-libs/commons-io/basic/line-iterator.html


Code looks like below

import org.apache.commons.io.LineIterator;

public class LineIteratorTest {

  /**
   * @param args
   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    File file = new File("C:/Test/rule_engine_names.txt");
    LineIterator lineIt = FileUtils.lineIterator(file, "UTF-8");
   
    while (lineIt.hasNext()) {
      System.out.println(lineIt.next());
//Here i need to somehow prepare inputFileMsg as String object
    }
   
    LineIterator.closeQuietly(lineIt);
  }
}  
 
   
 

//LAter I need to call
parseMsgFile(inputFileMsg);

other method looks like this


      public Object parseMsgFile(String inputFileMsg) throws Exception {

...
}


How to prepare inputFileMsg as String object?


please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 39895522
I suspect that class is pretty old (it would be redundant if invented after Scanner)

If you want to turn a file into a String:

http://technojeeves.com/index.php/aliasjava1/57-file-to-string-in-java
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39895769
:)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Loop 6 60
SHA2 certs for IIS AND Java? 2 87
Desingning Refactoring existing code 2 24
How do I remove an object from a 3 25
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

770 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