Java BufferedReader Read Line readLine(String fileName)

Here you can find the source of readLine(String fileName)

Description

read Line

License

Open Source License

Declaration

public static String readLine(String fileName) throws Exception 

Method Source Code


//package com.java2s;
import java.io.BufferedReader;

import java.io.FileReader;

public class Main {

    public static String readLine(String fileName) throws Exception {
        if (fileName == null) {
            return null;
        }/*from  ww w .j  a  va2  s.c  om*/
        BufferedReader in = null;
        try {
            in = new BufferedReader(new FileReader(fileName));
            String str = in.readLine();
            if (str != null) {
                str = str.trim();
            }
            return str;
        } catch (Exception e) {
            throw e;
        } finally {
            in.close();
        }
    }
}

Related

  1. readLine(InputStream input)
  2. readLine(InputStream input)
  3. readLine(RandomAccessFile wiki)
  4. readLine(Reader rd)
  5. readLine(String fileName)
  6. readLine(String filename, String encoding)
  7. readLine(String filepath)
  8. readLine(String filePathAndName, String encoding)
  9. readLine(String fmt, Object... args)