Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import android.content.Context;

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

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

public class Main {
    public static String readFile(Context context, String name) throws IOException {
        File file = context.getFileStreamPath(name);
        InputStream is = new FileInputStream(file);

        byte b[] = new byte[(int) file.length()];

        is.read(b);
        is.close();

        String string = new String(b);

        return string;
    }
}