Java Text File Read Line readLines(final File file)

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

Description

read Lines

License

Open Source License

Declaration

public static final String readLines(final File file) throws IOException 

Method Source Code


//package com.java2s;
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 final String readLines(final String file) throws IOException {
        return readLines(new File(file));
    }/*from ww  w.j  a v a2  s .  c om*/

    public static final String readLines(final File file) throws IOException {
        final InputStream stream = new FileInputStream(file);
        final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
        String lines = "";
        String line;
        while ((line = reader.readLine()) != null)
            lines += line;
        reader.close();
        stream.close();
        return lines;
    }
}

Related

  1. readLines(File file, String encoding)
  2. readLines(File file, String encoding)
  3. readLines(File file, String outputLineEnding)
  4. readLines(File inputFile)
  5. readLines(File inputFile, String encoding)
  6. readlines(final File file)
  7. readLines(int problemNumber)
  8. readLines(String body)
  9. readLines(String file)