Android UTF8 File Read loadUTF8LinesFromFile(File file)

Here you can find the source of loadUTF8LinesFromFile(File file)

Description

load UTF Lines From File

Declaration

public static List<String> loadUTF8LinesFromFile(File file)
            throws IOException 

Method Source Code

//package com.java2s;

import java.io.File;
import java.io.FileInputStream;

import java.io.IOException;
import java.io.InputStream;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static List<String> loadUTF8LinesFromFile(File file)
            throws IOException {
        InputStream is = new FileInputStream(file);
        Scanner scanner = new Scanner(is, "UTF-8");
        List<String> r = new ArrayList<String>();
        while (scanner.hasNextLine())
            r.add(scanner.nextLine());/*ww  w.j  a v  a2 s  .c o m*/
        is.close();
        return r;
    }
}

Related

  1. loadUTF8(File file)
  2. readFile(String fileName, String encoding)
  3. readFromFile(String fileName)