Java Path File Read nio readLinesFromFile(Path path)

Here you can find the source of readLinesFromFile(Path path)

Description

read Lines From File

License

Open Source License

Declaration

public static List<String> readLinesFromFile(Path path) 

Method Source Code

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

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

import java.util.List;

public class Main {
    public static List<String> readLinesFromFile(Path path) {
        try {/*from  w  ww  .  j  a va 2s  .c om*/
            return Files.readAllLines(path, StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new UnsupportedOperationException("Could not read from file '" + path + "'", e);
        }
    }
}

Related

  1. readKeyFile(String path)
  2. readLine(BufferedReader br, Path path)
  3. readLineByLine(String filePath)
  4. readLines(Path path, boolean ignoreComments)
  5. readLineS(String filePath, int line)
  6. readLinesFromFileLazy(String path)
  7. readLinesOfFile(String path)
  8. readLineSP(String filePath, int line, int pos)
  9. readLinesToString(Path file)