amazon web services - How to get an excel file from AWS W3 bucket into a MultipartFile in Java -


i've been trying extract .xlsx file aws bucket created , store multipartfile variable. i've tried many different approaches, @ best weird characters. i'm not finding documentation on how this. thanks!

// may need initialize differently correct authorization final amazons3client s3client = amazons3clientbuilder.defaultclient();  final s3object object = s3client.getobject("mybucket", "filetodownload.xlsx");  // java 7 nio final path filepath = paths.get("localfile.xlsx"); files.copy(object.getobjectcontent(), filepath); final file localfile = filepath.tofile();  // or apache commons io final file localfile = new file("localfile.xlsx"); fileutils.copytofile(object.getobjectcontent(), localfile); 

i'm not 100% sure mean "multipartfile" - that's in context of file that's been sent http web service via multipart post or put. file you're getting s3 technically part of response http request, amazon java library abstracts away you, , gives results inputstream.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -