Java BufferedReader Read readFile(final File file)

Here you can find the source of readFile(final File file)

Description

read File

License

Open Source License

Declaration

protected static String readFile(final File file) throws IOException 

Method Source Code


//package com.java2s;

import java.io.BufferedReader;
import java.io.File;

import java.io.FileReader;
import java.io.IOException;

public class Main {
    protected static String readFile(final File file) throws IOException {
        final StringBuilder builder = new StringBuilder();
        final BufferedReader reader = new BufferedReader(new FileReader(file));
        for (;;) {
            final String line = reader.readLine();
            if (line == null)
                break;
            builder.append(line).append('\n');
        }/* w w w. jav a2 s. com*/
        reader.close();

        return builder.toString();
    }
}

Related

  1. readFile(File location)
  2. readFile(File path)
  3. readFile(File testPage)
  4. readFile(final File argFile)
  5. readFile(final File file)
  6. readFile(final File file)
  7. readFile(final File file)
  8. readFile(final File file)
  9. readFile(final File paramFile, final boolean paramWhitespaces)