Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.commons.imaging.formats.jpeg.xmp.JpegXmpRewriter;
- AmazonS3Client client = nfile.getS3Client() //get S3 client
- S3Object object1 = client.getObject(
- new GetObjectRequest("test-bucket", "myfile.jpg")) //get the object.
- InputStream isNew1 = object1.getObjectContent(); //create input stream
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- PipedInputStream inpipe = new PipedInputStream();
- final PipedOutputStream out = new PipedOutputStream(inpipe);
- try {
- String xmpXml = "<x:xmpmeta>" +
- "n<Lifeshare>" +
- "nt<Date>"+"some date"+"</Date>" +
- "n</Lifeshare>" +
- "n</x:xmpmeta>";/
- JpegXmpRewriter rewriter = new JpegXmpRewriter();
- rewriter.updateXmpXml(isNew1,os, xmpXml); //This is step2
- try {
- println "starting writeto"
- os.writeTo(out);
- println "ending writeto"
- os.close();
- out.close();
- } catch (IOException e) {
- // logging and exception handling should go here
- }
- }
- finally {
- isNew1.close()
- os.close()
- out.close()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement