Here you can find the source of fileToString(InputStream file)
Parameter | Description |
---|---|
file | Nomobre del fichero |
private static String fileToString(InputStream file)
//package com.java2s; //License from project: Open Source License import java.io.InputStream; import java.util.Scanner; public class Main { /**//from www . j av a 2 s. c o m * Pasa todo el contenido de un fichero a una cadena * * @param file * Nomobre del fichero * @return */ private static String fileToString(InputStream file) { String style = ""; Scanner sc = new Scanner(file); while (sc.hasNextLine()) { style += sc.nextLine() + "\n"; } sc.close(); return style; } }