Solved

inputFileMsg as String object from file

Posted on 2014-02-28
2
547 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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.

749 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