Android-Exif-Extended icon indicating copy to clipboard operation
Android-Exif-Extended copied to clipboard

Function to write to a stream rather than file

Open BenStorey opened this issue 8 years ago • 2 comments

Hello,

Thanks for putting this library together. For a project I'm working on I put everything through an encryption cipher before writing anything to disk, so only having writeExif functions that write to a file makes things a little more difficult. Could you expose a function in ExifInterface that writes to a stream rather than an output file?

For my project I've just included your source entirely and added this function, which seems to work for my needs:

public void writeExif(final InputStream input, final OutputStream output) throws IOException
{
    writeExif_internal(input, output, mData);
    IOUtils.copy(input, output);
    output.flush();
    output.close();
}

Thanks!

(I would have done a pull request but I'm not really familiar with how to do them properly, so for such a small snippet have just included here!)

BenStorey avatar Apr 09 '16 14:04 BenStorey

Hi, can you create a pull request?

sephiroth74 avatar Apr 09 '16 23:04 sephiroth74

Sure, thanks!

https://github.com/sephiroth74/Android-Exif-Extended/pull/24

BenStorey avatar Aug 19 '20 14:08 BenStorey