List of usage examples for org.apache.commons.io IOUtils toString
public static String toString(byte[] input, String encoding) throws IOException
byte[]
as a String using the specified character encoding. From source file:com.hp.mqm.clt.ResourceUtils.java
public static String readContent(String fileName) throws IOException { return IOUtils.toString(RestClientTest.class.getResourceAsStream(fileName), "UTF-8"); }
From source file:de.fraunhofer.iais.eis.jrdfb.util.FileUtils.java
public static String readResource(String fileName, Class<?> resourceClass) throws IOException { return IOUtils.toString(resourceClass.getResourceAsStream(fileName), "UTF-8"); }
From source file:ca.uqam.inf2015.jsonapplication.utilitaires.FileReader.java
public static String loadFileIntoString(String filePath, String fileEncoding) throws FileNotFoundException, IOException { return IOUtils.toString(new FileInputStream(filePath), fileEncoding); }
From source file:lab1_2_exercice5.Utf8File.java
public static String loadFileIntoString(String filePath) throws FileNotFoundException, IOException { return IOUtils.toString(new FileInputStream(filePath), "UTF-8"); }
From source file:com.eviware.soapui.support.uri.HttpParser.java
public static String readLine(InputStream inputStream, String charset) throws IOException { return IOUtils.toString(inputStream, charset); }
From source file:Fondation.Utf8File.java
public static String loadFileIntoString(String filePath) throws FileNotFoundException { String res = ""; try {/*from w ww . ja v a 2s . com*/ res = IOUtils.toString(new FileInputStream(filePath), "UTF-8"); } catch (FileNotFoundException e) { throw e; } catch (IOException e) { System.out.println("Erreur lors de la lecture du fichier."); System.exit(1); } return res; }
From source file:com.github.riccardove.easyjasub.commons.CommonsIOUtils.java
public static String streamToString(InputStream is) throws IOException { return IOUtils.toString(is, EasyJaSubCharset.CHARSET); }
From source file:com.google.gwt.site.markdown.Util.java
public static String getStringFromFile(File file) throws IOException { FileInputStream fileInputStream = null; try {/*from ww w.j a v a 2s . c om*/ fileInputStream = new FileInputStream(file); return IOUtils.toString(fileInputStream, "UTF-8"); } finally { IOUtils.closeQuietly(fileInputStream); } }
From source file:it.cnr.ilc.tokenizer.utils.Utilities.java
public static String readFileContent(String filepath) throws IOException { String message = ""; File initialFile;/*www . j ava 2 s . com*/ InputStream targetStream = null; String theString = ""; try { initialFile = new File(filepath); targetStream = FileUtils.openInputStream(initialFile); theString = IOUtils.toString(targetStream, "UTF-8"); } catch (IOException e) { message = "IOaaException in reading the stream for " + filepath + " " + e.getMessage(); Logger.getLogger(Utilities.class.getName()).log(Level.SEVERE, message); //System.exit(-1); } finally { if (targetStream != null) { try { targetStream.close(); } catch (IOException e) { message = "IOException in closing the stream for " + filepath + " " + e.getMessage(); Logger.getLogger(Utilities.class.getName()).log(Level.SEVERE, message); //System.exit(-1); } } } //System.err.println(theString); return theString; }
From source file:com.github.easyjsonapi.TestHelper.java
/** * Retrive the json inside the test file * /*from w w w. j a va 2s .c o m*/ * @param fileName * the file name * @return string with json to test */ public static String retriveJsonFile(String fileName) { String json = null; try { json = IOUtils.toString(TestHelper.class.getClassLoader().getResourceAsStream(fileName), "UTF-8"); } catch (IOException e) { e.printStackTrace(); } return json; }