I am using try-with-resource block in my code, wondering is there a need to close the resource at the end of the method or not needed?
try (S3Object object = s3.getObject(new GetObjectRequest(bucketName, key));
BufferedReader br = new BufferedReader(new InputStreamReader(object.getObjectContent()));
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("output.txt")))){
String line;
while((line=br.readLine())!=null){
bw.write(line);
bw.newLine();
bw.flush();
}
}