| 1 |
package com.drew.metadata.xmp; |
| 2 |
|
| 3 |
import java.io.OutputStream; |
| 4 |
|
| 5 |
import com.adobe.internal.xmp.XMPException; |
| 6 |
import com.adobe.internal.xmp.XMPMeta; |
| 7 |
import com.adobe.internal.xmp.XMPMetaFactory; |
| 8 |
import com.adobe.internal.xmp.options.SerializeOptions; |
| 9 |
import com.drew.metadata.Metadata; |
| 10 |
|
| 11 |
public class XmpWriter |
| 12 |
{ |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
public static boolean write(OutputStream os, Metadata data) throws XMPException |
| 20 |
{ |
| 21 |
XmpDirectory dir = data.getFirstDirectoryOfType(XmpDirectory.class); |
| 22 |
if (dir == null) |
| 23 |
return false; |
| 24 |
XMPMeta meta = dir.getXMPMeta(); |
| 25 |
SerializeOptions so = new SerializeOptions().setOmitPacketWrapper(true); |
| 26 |
XMPMetaFactory.serialize(meta, os, so); |
| 27 |
return true; |
| 28 |
} |
| 29 |
} |