read File in UTF-8 encoding - Android File Input Output

Android examples for File Input Output:UTF File

Description

read File in UTF-8 encoding

Demo Code


//package com.java2s;
import android.content.Context;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

public class Main {
    public static Reader readFile(Context context, String fileName)
            throws IOException {
        InputStream inputStream = context.getAssets().open(fileName);
        Reader reader = new InputStreamReader(inputStream, "utf-8");
        return reader;
    }//w w w  . j a va2 s . c  om
}

Related Tutorials