Android File to String Read fromFile(File f)

Here you can find the source of fromFile(File f)

Description

from File

Declaration

public static String fromFile(File f) throws IOException 

Method Source Code

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

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

public class Main {
    public static String fromFile(File f) throws IOException {
        InputStream is = new FileInputStream(f);
        byte[] bs = new byte[is.available()];
        is.read(bs);//  w  ww  . j  a  v a 2 s  .c o m
        is.close();
        return new String(bs);
    }
}

Related

  1. getStringArrayFromFile(File inputFile)
  2. getStringFromFile(File inputFile)
  3. readFile(String path)
  4. readFileOfList(String path)