gpt4 book ai didi

com.adobe.xmp.XMPException.getMessage()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 18:52:40 27 4
gpt4 key购买 nike

本文整理了Java中com.adobe.xmp.XMPException.getMessage()方法的一些代码示例,展示了XMPException.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMPException.getMessage()方法的具体详情如下:
包路径:com.adobe.xmp.XMPException
类名称:XMPException
方法名:getMessage

XMPException.getMessage介绍

暂无

代码示例

代码示例来源:origin: drewnoakes/metadata-extractor

/**
 * 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 String xmpString, @NotNull Metadata metadata, @Nullable Directory parentDirectory)
{
  XmpDirectory directory = new XmpDirectory();
  if (parentDirectory != null)
    directory.setParent(parentDirectory);
  try {
    XMPMeta xmpMeta = XMPMetaFactory.parseFromString(xmpString);
    directory.setXMPMeta(xmpMeta);
  } catch (XMPException e) {
    directory.addError("Error processing XMP data: " + e.getMessage());
  }
  if (!directory.isEmpty())
    metadata.addDirectory(directory);
}

代码示例来源:origin: drewnoakes/metadata-extractor

/**
 * 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);
}

代码示例来源:origin: org.verapdf/pdfbox-metadata-fixer

private static MetadataImpl parseMetadata(PDMetadata meta) {
  try {
    VeraPDFMeta xmp = VeraPDFMeta.parse(meta.getStream().getUnfilteredStream());
    if (xmp != null) {
      return new MetadataImpl(xmp, meta.getStream());
    }
  } catch (IOException e) {
    LOGGER.debug("Problems with document parsing or structure. " + e.getMessage(), e);
  } catch (XMPException e) {
    LOGGER.debug("Problems with XMP parsing. " + e.getMessage(), e);
  }
  return null;
}

代码示例来源:origin: org.verapdf/metadata-fixer

private static MetadataImpl parseMetadata(PDMetadata meta, PDDocument document) {
  try {
    VeraPDFMeta xmp = VeraPDFMeta.parse(meta.getStream());
    if (xmp != null) {
      return new MetadataImpl(xmp, meta.getObject(),
          document.getDocument(), false);
    }
  } catch (XMPException e) {
    LOGGER.log(Level.FINE, "Problems with XMP parsing. " + e.getMessage(), e);
  }
  return null;
}

代码示例来源:origin: org.verapdf/validation-model

/**
 * Matches properties of document information dictionary and xmp metadata.
 *
 * @param document which will be tested
 * @return true if fields of xmp matches with fields of info dictionary
 */
public static Boolean doesInfoMatchXMP(COSDocument document) {
  COSObject info = getInformationDictionary(document);
  if (info == null) {
    return Boolean.TRUE;
  }
  try (InputStream metadataStream = getMetadataStream(document)) {
    if (metadataStream != null) {
      VeraPDFMeta metadata = VeraPDFMeta.parse(metadataStream);
      Map<ASAtom, Object> properties = new HashMap<>(
          MAX_REQUIRED_RECORDS);
      getTitleAuthorSubject(metadata, properties);
      getProducerKeywords(metadata, properties);
      getCreatorAndDates(metadata, properties);
      return checkMatch(info, properties);
    }
  } catch (IOException e) {
    LOGGER.log(Level.FINE,
        "Problems with document parsing or structure. "
            + e.getMessage(), e);
  } catch (XMPException e) {
    LOGGER.log(Level.FINE, "Problems with XMP parsing. " + e.getMessage(), e);
  }
  return Boolean.FALSE;
}

代码示例来源:origin: org.verapdf/pdfbox-validation-model

/**
 * Matches properties of document information dictionary and xmp metadata.
 *
 * @param document
 *            which will be tested
 * @return true if fields of xmp matches with fields of info dictionary
 */
public static Boolean doesInfoMatchXMP(COSDocument document) {
  COSDictionary info = getInformationDictionary(document);
  if (info == null) {
    return Boolean.TRUE;
  }
  try {
    COSStream meta = getMetadataDictionary(document);
    if (meta != null) {
      VeraPDFMeta metadata = VeraPDFMeta.parse(meta.getUnfilteredStream());
      Map<String, Object> properties = new HashMap<>(MAX_REQUIRED_RECORDS);
      getTitleAuthorSubject(metadata, properties);
      getProducerKeywords(metadata, properties);
      getCreatorAndDates(metadata, properties);
      return checkMatch(info, properties);
    }
  } catch (IOException e) {
    LOGGER.debug("Problems with document parsing or structure. " + e.getMessage(), e);
  } catch (XMPException e) {
    LOGGER.debug("Problems with XMP parsing. " + e.getMessage(), e);
  }
  return Boolean.FALSE;
}

代码示例来源:origin: org.verapdf/validation-model

logger.log(Level.FINE, e.getMessage(), e);
  return defaultFlavour;
} catch (IOException e) {

代码示例来源:origin: com.drewnoakes/metadata-extractor

/**
 * 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 String xmpString, @NotNull Metadata metadata, @Nullable Directory parentDirectory)
{
  XmpDirectory directory = new XmpDirectory();
  if (parentDirectory != null)
    directory.setParent(parentDirectory);
  try {
    XMPMeta xmpMeta = XMPMetaFactory.parseFromString(xmpString);
    directory.setXMPMeta(xmpMeta);
  } catch (XMPException e) {
    directory.addError("Error processing XMP data: " + e.getMessage());
  }
  if (!directory.isEmpty())
    metadata.addDirectory(directory);
}

代码示例来源:origin: com.drewnoakes/metadata-extractor

/**
 * 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);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com