package com.jijo;
import org.apache.commons.io.FileUtils;
import java.io.File;
//use commons-io-1.3.2.jar
//download the above jar and include that in your class path.
class FileTest{
public String getFileData(String fileName){ //eg: c:/jijo/test.txt
String xmlData = null;
File file = new File(fileName);
try{
xmlData = FileUtils.readFileToString(file);
}
catch (Exception e) {
e.printStackTrace();
}
return xmlData;
}
}
Code Complete: A Practical Handbook of Software Construction
Visualage for Java Enterprise Edition
import org.apache.commons.io.FileUtils;
import java.io.File;
//use commons-io-1.3.2.jar
//download the above jar and include that in your class path.
class FileTest{
public String getFileData(String fileName){ //eg: c:/jijo/test.txt
String xmlData = null;
File file = new File(fileName);
try{
xmlData = FileUtils.readFileToString(file);
}
catch (Exception e) {
e.printStackTrace();
}
return xmlData;
}
}
Code Complete: A Practical Handbook of Software Construction
Visualage for Java Enterprise Edition
No comments:
Post a Comment