Java Text File Read by Charset readAllLines(Path path, Charset cs)

Here you can find the source of readAllLines(Path path, Charset cs)

Description

read All Lines

License

Open Source License

Declaration

public static List<String> readAllLines(Path path, Charset cs) 

Method Source Code

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

import java.io.IOException;
import java.nio.charset.Charset;
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> readAllLines(Path path, Charset cs) {
        try {/*  w  ww .  ja va  2s  .c om*/
            return Files.readAllLines(path, cs);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static List<String> readAllLines(Path path) {
        return readAllLines(path, StandardCharsets.UTF_8);
    }
}

Related

  1. readAll(InputStream in, Charset charset)
  2. readAll(InputStream inputStream, Charset charset)
  3. readAll(InputStream inputStream, Charset encoding)
  4. readAllLines(File file, Charset cs, String newLineDelimiter)
  5. readAllLines(InputStream stream, Charset charset)
  6. readAllText(File file, Charset charset)
  7. readAllText(File file, Charset charset)
  8. readAsString(InputStream in, Charset charset)
  9. readAsString(InputStream is, CharsetDecoder decoder)