Skip to content

Commit

Permalink
Merge pull request #2 from spmunna/spmunna-patch-2
Browse files Browse the repository at this point in the history
Update Transcribe.java
  • Loading branch information
spmunna authored Oct 5, 2021
2 parents c85c763 + 3ab7419 commit e78a015
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/main/java/transcribe/Transcribe.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ public void testFileFromAwsBucket(String fileName) {
String key = fileName.replaceAll(" ", "_").toLowerCase();
//String newKey = key + "-" + System.currentTimeMillis();
//s3Client().copyObject(bucketName, key, bucketName, newKey);
S3Object s3object = null;
S3ObjectInputStream inputStream = null;
try {
Thread.sleep(1000);
S3Object s3object = s3Client().getObject(bucketName, key);
S3ObjectInputStream inputStream = s3object.getObjectContent();
s3object = s3Client().getObject(bucketName, key);
inputStream = s3object.getObjectContent();
File file = new File("/tmp/test2.wav");
if (file.createNewFile()) {
System.out.println("File created: " + file.getName());
Expand All @@ -110,6 +112,19 @@ public void testFileFromAwsBucket(String fileName) {

}catch(Exception e) {
e.printStackTrace();
}finally{

try{
if(s3object != null){
s3object.close();
}
if(inputStream != null){
inputStream.close();
}
}catch(Exception resExec){
resExec.printStackTrace();
}

}
}

Expand Down

0 comments on commit e78a015

Please sign in to comment.