Java BufferedReader Read readFile(String uri)

Here you can find the source of readFile(String uri)

Description

Read file.

License

Open Source License

Parameter

Parameter Description
uri the uri

Exception

Parameter Description
Exception the exception

Return

the string

Declaration

public static String readFile(String uri) throws Exception 

Method Source Code

//package com.java2s;
/**/*w  w w . j a v  a  2 s .  co m*/
 * Copyright (C) 2015 Cyril Bosselut <bossone0013@gmail.com>
 * <p>
 * This file is part of NeoJava examples for UDOO
 * <p>
 * NeoJava examples for UDOO is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * <p>
 * This libraries are distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * <p>
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

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

public class Main {
    /**
     * Read file.
     *
     * @param uri the uri
     * @return the string
     * @throws Exception the exception
     */
    public static String readFile(String uri) throws Exception {
        File file = new File(uri);
        FileReader fr = new FileReader(file.getAbsoluteFile());
        BufferedReader br = new BufferedReader(fr);
        String value = br.readLine();
        br.close();
        return value;
    }
}

Related

  1. readFile(String path)
  2. readFile(String path)
  3. readFile(String path)
  4. readFile(String pathname)
  5. readFile(String sFileName_)
  6. readFile(String xmlFile)
  7. readFileAsHash(File file)
  8. readFileAsLines(File fileLocation)
  9. readFileAsLines(String aFile)