Java InputStreamReader Read readFile(File resultFile)

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

Description

read File

License

Open Source License

Declaration

public static String readFile(File resultFile) throws IOException 

Method Source Code

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

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
    public static String readFile(File resultFile) throws IOException {
        StringBuilder result = new StringBuilder();
        // InputStream fileIn = GryphonResultUtil.class.getResource(resultFile).openStream();
        InputStream fileIn = new FileInputStream(resultFile);
        try {/*www.j a va 2  s. c  o m*/
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(fileIn));
            try {
                String line;
                while ((line = reader.readLine()) != null) {
                    result.append(line);
                    result.append("\n");
                }
                return result.toString();
            } finally {
                reader.close();
            }
        } finally {
            fileIn.close();
        }
    }
}

Related

  1. readFile(File file, String encoding)
  2. readFile(File file, String encoding)
  3. readFile(File file, String encoding)
  4. readFile(File filename)
  5. readFile(File path)
  6. readFile(File target)
  7. readFile(FileInputStream file)
  8. readFile(final File file)
  9. readFile(final File inputFile)