Java Scanner Read readFile(String path)

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

Description

read File

License

Open Source License

Declaration

public static String readFile(String path) 

Method Source Code

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

import java.util.*;

import java.io.*;

public class Main {
    public static String readFile(String path) {
        return readFile(new File(path));
    }//  ww w  .j  av a  2 s  .  c  om

    public static String readFile(File f) {
        try {
            return new Scanner(f, "UTF-8").useDelimiter("\\A").next();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. readFile(String fileName)
  2. readFile(String fileName)
  3. readFile(String filePath)
  4. readFile(String filePath)
  5. readFile(String filePath)
  6. readFile(String pathname)
  7. readFile(String project, boolean judge)
  8. readFileFully(InputStream stream)
  9. readFileToList(File file)