以下是我用于将文件上传到s3云服务器的代码。但是文件上传没有发生。我没有任何错误。任何帮助专家
URL url = new URL(s3Url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type","application/x-compressed");
connection.setRequestProperty("x-amz-server-side-encryption", "AES256");
File file = new File("myTar.tar.gz");
FileInputStream fileInputStream = new FileInputStream(file);
OutputStream outputStream = connection.getOutputStream();
byte[] buf = new byte[1024];
while ((n = fileInputStream.read(buf)) > -1) {
outputStream.write(buf, 0, n);
}
connection.getResponseCode();