|
楼主 |
发表于 2020-2-21 09:00:02
|
显示全部楼层
我的程序是:
try{
if (url != null) {
java.io.InputStream l_urlStream;
java.net.URL l_url = new java.net.URL(url);
java.net.HttpURLConnection l_connection = (java.net.HttpURLConnection) l_url
.openConnection();
l_connection.connect();
l_urlStream = l_connection.getInputStream();
java.io.BufferedReader l_reader = new java.io.BufferedReader(
new java.io.InputStreamReader(l_urlStream));
while ((sCurrentLine = l_reader.readLine()) != null) {
sTotalString += sCurrentLine + "\n";
}
// sTotalString = sTotalString.replaceAll("<", "<");
// sTotalString = sTotalString.replaceAll(">", ">");
sTotalString = sTotalString.replaceAll("\n", "<br>");
Files f = new Files();
// f.createAndDeleteFolder("aa\\tt","f:\\");
f.createAndDeleteFile("E:\\workspace\\testfile\\WebRoot\\", "welcome.htm");
f.writeFile("E:\\workspace\\testfile\\WebRoot\\", "welcome.htm", sTotalString);
System.out.println(" sTotalString " + sTotalString);
}
}catch(Exception d)
{
d.printStackTrace();
} |
|