Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import android.os.Environment;

public class Main {
    /**
     * get the FileInputStream
     * @param filePath, it must contains the head "/"
     * @return
     * @throws FileNotFoundException if the file is not exist
     */
    public static FileInputStream getFileInputStream(String filePath) throws FileNotFoundException {
        FileInputStream fins = null;
        File file = new File(Environment.getExternalStorageDirectory().getAbsoluteFile() + filePath);
        fins = new FileInputStream(file);
        return fins;
    }
}