Here you can find the source of readFile(String uri)
Parameter | Description |
---|---|
uri | the uri |
Parameter | Description |
---|---|
Exception | the exception |
public static String readFile(String uri) throws Exception
//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; } }