Solved

inputFileMsg as String object from file

Posted on 2014-02-28
2
538 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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 learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now