Here you can find the source of load(File in)
Parameter | Description |
---|---|
in | FIle to be loaded |
Parameter | Description |
---|---|
IOException | IO errors |
public static String load(File in) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import java.util.Scanner; public class Main { /**/*from w w w . jav a 2s. c om*/ * Used to load the entire file into String object * @param in FIle to be loaded * @return FIle content * @throws IOException IO errors */ public static String load(File in) throws IOException { Scanner sc = new Scanner(in); StringBuilder sb = new StringBuilder(); while (sc.hasNextLine()) { sb.append(sc.nextLine()).append("\n"); } return sb.toString(); } }