Here you can find the source of readStringFromBufferedReader(BufferedReader br)
Parameter | Description |
---|---|
br | the file |
Parameter | Description |
---|---|
IOException | an exception |
private static String readStringFromBufferedReader(BufferedReader br) throws IOException
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.net.URL; import java.util.UUID; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import net.sf.json.JSON; import net.sf.json.JSONObject; import org.apache.log4j.Logger; public class Main{ /**/*from www . jav a 2s . c o m*/ * Reads all content from the given {@link Reader} and returns it as a single {@link String} * * @param br the file * @return the file content as String * @throws IOException */ private static String readStringFromBufferedReader(BufferedReader br) throws IOException { StringBuffer sbr = new StringBuffer(); for (String ln = br.readLine(); ln != null; ln = br.readLine()) sbr.append(ln + "\n"); br.close(); return sbr.toString(); } }