Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit a682587

Browse files
committed
ReadMe : Update Code Sample
1 parent 6fc2315 commit a682587

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ public class BlobSample {
101101
// Upload an image file.
102102
CloudBlockBlob blob = container.getBlockBlobReference("image1.jpg");
103103
File sourceFile = new File("c:\\myimages\\image1.jpg");
104-
blob.upload(new FileInputStream(sourceFile), sourceFile.length());
104+
try (FileInputStream sourceStream = new FileInputStream(sourceFile)) {
105+
blob.upload(sourceStream, sourceFile.length());
106+
}
105107

106108
// Download the image file.
107109
File destinationFile = new File(sourceFile.getParentFile(), "image1Download.tmp");

0 commit comments

Comments
 (0)