Quick read files in Java (Scanner)

According to me reading files in JAVA is bit more complex as compared to C or C++

I came across Java Scanner API (JDK 1.5 onwards ) which easier than than common ways how we read fie using java line by line
Here is the sample code
private static String quickReadFile(String inFileName) {
String contents = null;
try {
Scanner scanner = new Scanner(new File(inFileName)).useDelimiter("Z");
contents = scanner.next();
} catch (FileNotFoundException ex) {
Logger.getLogger(ParseTagged.class.getName()).log(Level.SEVERE, null, ex);
return contents;


Popular posts from this blog

Bengali English word definition in Google Dictionary

Trace India Mobile Number

Load Testing Using Gatling