Java BufferedReader Read readFileAsListOfString(String fileName, String splitBy)

Here you can find the source of readFileAsListOfString(String fileName, String splitBy)

Description

read File As List Of String

License

Open Source License

Declaration

public static List<String> readFileAsListOfString(String fileName, String splitBy) throws IOException 

Method Source Code


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

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;

public class Main {
    public static List<String> readFileAsListOfString(String fileName, String splitBy) throws IOException {
        File file = new File(fileName);
        BufferedReader buffer = new BufferedReader(new FileReader(file));
        String line;/* w ww  .java2  s . c o m*/
        List<String> data = new ArrayList<>();
        while ((line = buffer.readLine()) != null) {
            data = Arrays.asList(line.split(splitBy));
        }
        return data;
    }
}

Related

  1. readFileAsHash(File file)
  2. readFileAsLines(File fileLocation)
  3. readFileAsLines(String aFile)
  4. readFileAsList(final String filename)
  5. readFileAsList(String filename, String splitter)
  6. readFileAsListOfStrings(String filename)
  7. readFileAsListOfStrings(String filename)
  8. readFileAsText(String path)
  9. readFileByChar(String path)