文件流输出到本地内存/直接访问外网路径,等到返回值
2016-01-25 09:40
399 查看
public static void logResult(String sWord) {
FileWriter writer = null;
try {
writer = new FileWriter(AlipayConfig.log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
writer.write(sWord);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static String checkUrl(String urlvalue) {
String inputLine = "";
try {
URL url = new URL(urlvalue);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection
.getInputStream()));
inputLine = in.readLine().toString();
} catch (Exception e) {
e.printStackTrace();
inputLine = "";
}
return inputLine;
}
FileWriter writer = null;
try {
writer = new FileWriter(AlipayConfig.log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
writer.write(sWord);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static String checkUrl(String urlvalue) {
String inputLine = "";
try {
URL url = new URL(urlvalue);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection
.getInputStream()));
inputLine = in.readLine().toString();
} catch (Exception e) {
e.printStackTrace();
inputLine = "";
}
return inputLine;
}
相关文章推荐
- [leetcode]Binary Tree Preorder Traversal
- 初识Rest、JSR、JCP、JAX-RS及Jersey
- java面试题(二)
- java提高篇(二)-----理解java的三大特性之继承
- Linux中gcc g++常用编译选项以及makefile的编写
- svn linux 服务器搭建
- Jmeter测试:JDBC请求
- DE10 Continuation: Complex Characteristic Roots
- 使SourceInsight支持Python语言的方法
- Android LayoutInflater原理分析,带你一步步深入了解View(一)
- 【百金轻】:乍暖还寒 最难将息
- centos6.x升级内核
- java面试题(一)
- 使用OGG"Loading data from file to Replicat"的方法应该注意的问题:replicat进程是前台进程
- 表单编辑组件使用指南
- JavaScript 类型转换
- java提高篇(一)-----理解java的三大特性之封装
- Flex MenuBar的使用学习
- POJ【2236】Wireless Network
- LeetCode Remove Duplicates from Sorted Array II