Java FileInputStream Read readFile(File f)

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

Description

read File

License

Open Source License

Declaration

public static String readFile(File f) throws IOException 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

import java.io.*;

public class Main {
    public static String readFile(File f) throws IOException {
        try (FileInputStream fis = new FileInputStream(f)) {
            byte[] data = new byte[(int) f.length()];
            fis.read(data);//from  w ww .  ja  va  2  s  .co  m
            return new String(data, "UTF-8");
        }
    }
}

Related

  1. readFile(File f)
  2. readFile(File f)
  3. readFile(File f)
  4. readFile(File f)
  5. readFile(File f)
  6. readFile(File f)
  7. readFile(File f)
  8. readFile(File f, int fetchLength, byte[] bytes)
  9. readFile(File f, int iChunkSize)