当前位置: 首页>>代码示例>>Java>>正文


Java XMPMetaFactory.parseFromBuffer方法代码示例

本文整理汇总了Java中com.adobe.xmp.XMPMetaFactory.parseFromBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java XMPMetaFactory.parseFromBuffer方法的具体用法?Java XMPMetaFactory.parseFromBuffer怎么用?Java XMPMetaFactory.parseFromBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.adobe.xmp.XMPMetaFactory的用法示例。


在下文中一共展示了XMPMetaFactory.parseFromBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extract

import com.adobe.xmp.XMPMetaFactory; //导入方法依赖的package包/类
/**
 * Performs the XMP data extraction, adding found values to the specified instance of {@link Metadata}.
 * <p>
 * The extraction is done with Adobe's XMPCore library.
 */
public void extract(@NotNull final byte[] xmpBytes, int offset, int length, @NotNull Metadata metadata, @Nullable Directory parentDirectory)
{
    XmpDirectory directory = new XmpDirectory();

    if (parentDirectory != null)
        directory.setParent(parentDirectory);

    try {
        XMPMeta xmpMeta;

        // If all xmpBytes are requested, no need to make a new ByteBuffer
        if (offset == 0 && length == xmpBytes.length) {
            xmpMeta = XMPMetaFactory.parseFromBuffer(xmpBytes);
        } else {
            ByteBuffer buffer = new ByteBuffer(xmpBytes, offset, length);
            xmpMeta = XMPMetaFactory.parse(buffer.getByteStream());
        }

        directory.setXMPMeta(xmpMeta);
    } catch (XMPException e) {
        directory.addError("Error processing XMP data: " + e.getMessage());
    }

    if (!directory.isEmpty())
        metadata.addDirectory(directory);
}
 
开发者ID:drewnoakes,项目名称:metadata-extractor,代码行数:32,代码来源:XmpReader.java

示例2: extractXMPMeta

import com.adobe.xmp.XMPMetaFactory; //导入方法依赖的package包/类
/**
 *  Extracts XMPMeta from a JPEG image file stream.
 *
 * @param is the input stream containing the JPEG image file.
 * @return Extracted XMPMeta or null.
 */
public static XMPMeta extractXMPMeta(InputStream is) {
  List<Section> sections = parse(is, true);
  if (sections == null) {
    return null;
  }
  // Now we don't support extended xmp.
  for (Section section : sections) {
    if (hasXMPHeader(section.data)) {
      int end = getXMPContentEnd(section.data);
      byte[] buffer = new byte[end - XMP_HEADER_SIZE];
      System.arraycopy(
          section.data, XMP_HEADER_SIZE, buffer, 0, buffer.length);
      try {
        XMPMeta result = XMPMetaFactory.parseFromBuffer(buffer);
        return result;
      } catch (XMPException e) {
        Log.d(TAG, "XMP parse error", e);
        return null;
      }
    }
  }
  return null;
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:30,代码来源:XmpUtil.java

示例3: extract

import com.adobe.xmp.XMPMetaFactory; //导入方法依赖的package包/类
/**
 * Performs the XMP data extraction, adding found values to the specified instance of {@link Metadata}.
 * <p/>
 * The extraction is done with Adobe's XMPCore library.
 */
public void extract(@NotNull final byte[] xmpBytes, @NotNull Metadata metadata)
{
    XmpDirectory directory = metadata.getOrCreateDirectory(XmpDirectory.class);

    try {
        XMPMeta xmpMeta = XMPMetaFactory.parseFromBuffer(xmpBytes);
        processXmpTags(directory, xmpMeta);
    } catch (XMPException e) {
        directory.addError("Error processing XMP data: " + e.getMessage());
    }
}
 
开发者ID:byronb92,项目名称:ImageEXIFExtraction,代码行数:17,代码来源:XmpReader.java


注:本文中的com.adobe.xmp.XMPMetaFactory.parseFromBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。