服务器正在发送jar文件,我想将其保存在特定目录中。 我的HttpURLConnection只读取文件的内容
public static String update(String url, String version) throws MalformedURLException, IOException {
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
return readResponse(con.getInputStream());
}
private static String readResponse(InputStream in){
BufferedReader br = new BufferedReader(new InputStreamReader((in)));
StringBuilder sb = new StringBuilder();
String output;
while ((output = br.readLine()) != null) {
sb.append(output);
}
return sb.toString();
}
答案 0 :(得分:4)
为什么要将其解析为字符串? 也许尝试(https://www.baeldung.com/java-download-file)
A = 1,2,3,4,5,6,8
B = 1,2,3,4,5,6,8
res = set()
for a in A:
for b in B:
if a * b == 24:
if {a, b} not in res:
print(a, b, a + b)
res.add(frozenset((a, b)))