我在 String readFileIntoString(String path) 中遇到错误,因为表达式的非法开头有人可以告诉我该怎么做。
public static void main(String[] args) {
//public class PreProcess {
// Read a file into a string. Takes file path, returns string
/**
*
* @param path
* @return
*/
public String readFileIntoString(String path) {
char[] line = new char[1024];
StringBuilder dataString;
dataString = new StringBuilder(5000);
try {
try (BufferedReader input = new BufferedReader(new FileReader(path))) {
while (true) {
int readLength = input.read(line);
if (readLength == -1)
break;
dataString.append(line, 0, readLength);
}
}
return dataString.toString();
}
catch (IOException e) {
return " ";
}
}
}