@@ -47,36 +47,18 @@ public Boolean Copy(FileDataStore destStore, String srcPath, String destPath) {
4747 }
4848 @ Override
4949 public InputStream Get (String path ) {
50- //byte[] data;
50+ S3Object fullObject = null ;
51+ String key = postFix + "/" + path ;
52+ System .out .println (path );
53+ System .out .println (bucket );
5154 try {
52- S3Object fullObject = null ;
53- String key = postFix + "/" + path ;
54- System .out .println (path );
55- System .out .println (bucket );
56- try {
57- fullObject = awsS3 .getObject (new GetObjectRequest (bucket , key ));
58- System .out .println ("Content-Type: " + fullObject .getObjectMetadata ().getContentType ());
59- return fullObject .getObjectContent ();
60- } catch (Exception e ) {
61- throw e ;
62- } finally {
63- // To ensure that the network connection doesn't remain open, close any open input streams.
64- if (fullObject != null ) {
65- try {
66- fullObject .close ();
67- } catch (Exception e ) {
68- System .out .println ("key " + key + " failed to download.\n " + e .getMessage ());
69- throw e ;
70-
71- //return fullObject.getObjectContent();
72- }
73- }
74- }
75-
76- } catch (Exception e ) {
55+ fullObject = awsS3 .getObject (new GetObjectRequest (bucket , key ));
56+ System .out .println ("Content-Type: " + fullObject .getObjectMetadata ().getContentType ());
57+ return fullObject .getObjectContent ();
58+ } catch (Exception e ) {
7759 e .printStackTrace ();
7860 return null ;
79- }
61+ }
8062 }
8163
8264 @ Override
0 commit comments