Java Scanner Read readFile(String fileName)

Here you can find the source of readFile(String fileName)

Description

read File

License

Open Source License

Declaration

public static String readFile(String fileName) throws FileNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileNotFoundException;

import java.util.Scanner;

public class Main {
    public static String readFile(String fileName) throws FileNotFoundException {
        return new Scanner(new File(fileName)).useDelimiter("\\A").next();
    }/*from  w w w  .  j a va  2 s .  co  m*/
}

Related

  1. readFile(File path)
  2. readFile(final File f)
  3. readFile(String file_name)
  4. readFile(String filename)
  5. readFile(String fileName)
  6. readFile(String fileName)
  7. readFile(String filePath)
  8. readFile(String filePath)
  9. readFile(String filePath)