gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-22 05:03:05 25 4
gpt4 key购买 nike

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

XMPMeta.getArrayItem介绍

[英]Provides access to items within an array. The index is passed as an integer, you need not worry about the path string syntax for array items, convert a loop index to a string, etc.
[中]提供对阵列中项目的访问。索引是以整数形式传递的,您不必担心数组项的路径字符串语法、将循环索引转换为字符串等。

代码示例

代码示例来源:origin: apache/tika

/**
 * Returns the value of a simple property or the first one of an array. The given name must
 * contain a namespace prefix of a registered namespace.
 *
 * @see org.apache.tika.metadata.Metadata#get(java.lang.String)
 */
@Override
public String get(String name) {
  checkKey( name );
  String value = null;
  String[] keyParts = splitKey( name );
  String ns = registry.getNamespaceURI( keyParts[0] );
  if (ns != null) {
    try {
      XMPProperty prop = xmpData.getProperty( ns, keyParts[1] );
      if (prop != null && prop.getOptions().isSimple()) {
        value = prop.getValue();
      }
      else if (prop != null && prop.getOptions().isArray()) {
        prop = xmpData.getArrayItem( ns, keyParts[1], 1 );
        value = prop.getValue();
      }
      // in all other cases, null is returned
    }
    catch (XMPException e) {
      // Ignore
    }
  }
  return value;
}

代码示例来源:origin: apache/tika

prop = xmpData.getArrayItem( ns, keyParts[1], i + 1 );
if (prop.getOptions().isSimple()) {
  value[i] = prop.getValue();

代码示例来源:origin: apache/tika

@Test
public void process_genericConversion_ok() throws TikaException, XMPException {
  xmpMeta.process( tikaMetadata, GENERIC_MIMETYPE );
  XMPMeta xmp = xmpMeta.getXMPData();
  // check simple property
  XMPProperty prop = xmp.getProperty( XMPConst.NS_DC, "format" );
  assertNotNull( prop );
  assertEquals( GENERIC_MIMETYPE, prop.getValue() );
  // check lang alt
  prop = xmp.getLocalizedText( XMPConst.NS_DC, "title", null, XMPConst.X_DEFAULT );
  assertNotNull( prop );
  assertEquals( "title", prop.getValue() );
  // check array
  prop = xmp.getArrayItem( XMPConst.NS_DC, "subject", 1 );
  assertNotNull( prop );
  assertEquals( "keyword1", prop.getValue() );
  prop = xmp.getArrayItem( XMPConst.NS_DC, "subject", 2 );
  assertNotNull( prop );
  assertEquals( "keyword2", prop.getValue() );
}

代码示例来源:origin: apache/tika

private void checkOOXMLMetadata(XMPMeta xmp) throws XMPException {
  // check simple property
  XMPProperty prop = xmp.getProperty( XMPConst.NS_DC, "language" );
  assertNotNull( prop );
  assertEquals( "language", prop.getValue() );
  // check lang alt
  prop = xmp.getLocalizedText( XMPConst.NS_DC, "title", null, XMPConst.X_DEFAULT );
  assertNotNull( prop );
  assertEquals( "title", prop.getValue() );
  // check array
  prop = xmp.getArrayItem( XMPConst.NS_DC, "subject", 1 );
  assertNotNull( prop );
  assertEquals( "keyword1", prop.getValue() );
  prop = xmp.getArrayItem( XMPConst.NS_DC, "subject", 2 );
  assertNotNull( prop );
  assertEquals( "keyword2", prop.getValue() );
  // check OOXML specific simple property
  prop = xmp.getProperty( OfficeOpenXMLCore.NAMESPACE_URI, "lastModifiedBy" );
  assertNotNull( prop );
  assertEquals( "lastModifiedBy", prop.getValue() );
}

代码示例来源:origin: apache/tika

@Test
public void convert_genericMetadataAllQualified_allConverted() throws XMPException,
    TikaException {
  // simple property
  tikaMetadata.set( TikaCoreProperties.FORMAT, GENERIC_MIMETYPE );
  // language alternative
  tikaMetadata.set( TikaCoreProperties.TITLE, "title" );
  // array
  tikaMetadata.set( TikaCoreProperties.SUBJECT, new String[] { "keyword1", "keyword2" } );
  XMPMeta xmp = TikaToXMP.convert( tikaMetadata, null );
  // check simple property
  XMPProperty prop = xmp.getProperty( XMPConst.NS_DC, "format" );
  assertNotNull( prop );
  assertEquals( GENERIC_MIMETYPE, prop.getValue() );
  // check lang alt
  prop = xmp.getLocalizedText( XMPConst.NS_DC, "title", null, XMPConst.X_DEFAULT );
  assertNotNull( prop );
  assertEquals( "title", prop.getValue() );
  // check array
  prop = xmp.getArrayItem( XMPConst.NS_DC, "subject", 1 );
  assertNotNull( prop );
  assertEquals( "keyword1", prop.getValue() );
  prop = xmp.getArrayItem( XMPConst.NS_DC, "subject", 2 );
  assertNotNull( prop );
  assertEquals( "keyword2", prop.getValue() );
}

代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-xmp

/**
 * Returns the value of a simple property or the first one of an array. The given name must
 * contain a namespace prefix of a registered namespace.
 *
 * @see org.apache.tika.metadata.Metadata#get(java.lang.String)
 */
@Override
public String get(String name) {
  checkKey( name );
  String value = null;
  String[] keyParts = splitKey( name );
  String ns = registry.getNamespaceURI( keyParts[0] );
  if (ns != null) {
    try {
      XMPProperty prop = xmpData.getProperty( ns, keyParts[1] );
      if (prop != null && prop.getOptions().isSimple()) {
        value = prop.getValue();
      }
      else if (prop != null && prop.getOptions().isArray()) {
        prop = xmpData.getArrayItem( ns, keyParts[1], 1 );
        value = prop.getValue();
      }
      // in all other cases, null is returned
    }
    catch (XMPException e) {
      // Ignore
    }
  }
  return value;
}

代码示例来源:origin: org.apache.tika/tika-xmp

/**
 * Returns the value of a simple property or the first one of an array. The given name must
 * contain a namespace prefix of a registered namespace.
 *
 * @see org.apache.tika.metadata.Metadata#get(java.lang.String)
 */
@Override
public String get(String name) {
  checkKey( name );
  String value = null;
  String[] keyParts = splitKey( name );
  String ns = registry.getNamespaceURI( keyParts[0] );
  if (ns != null) {
    try {
      XMPProperty prop = xmpData.getProperty( ns, keyParts[1] );
      if (prop != null && prop.getOptions().isSimple()) {
        value = prop.getValue();
      }
      else if (prop != null && prop.getOptions().isArray()) {
        prop = xmpData.getArrayItem( ns, keyParts[1], 1 );
        value = prop.getValue();
      }
      // in all other cases, null is returned
    }
    catch (XMPException e) {
      // Ignore
    }
  }
  return value;
}

代码示例来源:origin: org.apache.tika/tika-xmp

prop = xmpData.getArrayItem( ns, keyParts[1], i + 1 );
if (prop.getOptions().isSimple()) {
  value[i] = prop.getValue();

代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-xmp

prop = xmpData.getArrayItem( ns, keyParts[1], i + 1 );
if (prop.getOptions().isSimple()) {
  value[i] = prop.getValue();

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