1.6. Network

简介:

Java 网络相关操作

1.6.1. URL

		
import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {

        URL url = new URL("http://www.netkiller.cn/");
        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }
}
		
		

1.6.2. java.io.tmpdir

改变java.io.tmpdir的默认值

System.setProperty("java.io.tmpdir", "/vat/tmp");
System.out.println(System.getProperty("java.io.tmpdir"));
		




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
打赏
0
0
0
0
26197
分享
相关文章
Network Policy及应用
文章主要介绍了如何在Kubernetes中使用Network Policy进行网络策略配置,包括如何部署Calico网络模型来支持网络策略,以及如何通过设置不同的网络策略来控制不同命名空间下Pods之间的访问权限。
83 4
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等