Example

Below is an example of a call to getSummaryInfo():

SummaryInfo[] sinfo = objFilter.getSummaryInfo();
if(sinfo != null)
{
  System.out.println("\nSummary info has been extracted.");
  fos_sum = new FileOutputStream(summaryOutFile);
  DataOutputStream dos_sum = new DataOutputStream(fos_sum);
  for(int i=0; i<sinfo.length; i++)
  {
     if(sinfo[i].getElementName() != null)
    {
       dos_sum.writeBytes("Element name: " + sinfo[i].getElementName() + "\n");
       dos_sum.writeBytes("Element type: " + sinfo[i].getSumInfoType() + "\n");
       if(sinfo[i].getIsValid() == true)
      {
         if(sinfo[i].isDateTimeType())
        {
           dos_sum.writeBytes("Date/time: ");
           dos_sum.writeBytes(sinfo[i].getDateTime());
        }
         else
        {
           byte[] data = sinfo[i].getData();
           if(data != null)
          {
             dos_sum.writeBytes("Element data: "); 
             dos_sum.write(data);
          }
        }
      }
      dos_sum.writeBytes("\n\n");
    }
  }
  dos_sum.close();
  fos_sum.close;
}
sinfo=null;

The SummaryInfo class stores the metadata extraction results. After calling the Filter.getSummaryInfo()method, call the get methods provided by each instance of this class to extract metadata:

getElementName()

Gets the name of the metadata element.

getSumInfoType()

Specifies the data type of the metadata element. The possible types are:

  • KV_String—The value in the metadata field is a string.
  • KV_Int4—The value in the metadata field is an integer.
  • KV_DateTime—The value in the metadata field is a date and time. This type is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (Windows FILETIME EPOCH). You might need to convert this value into another format.

You can also use the isDateTimeType() method to determine whether a metadata element is of date/time type, and then use the getDateTime() method to obtain the date/time in the form of a string.

  • KV_ClipBoard—Currently not supported.
  • KV_Bool—The value in the metadata field is a boolean.
  • KV_Unicode—The value in the metadata field is a Unicode string.
  • KV_IEEE8—The value in the metadata field is an IEEE 8-byte integer.
  • KV_Other—The value in the metadata field is user-defined.

getIsValid()

Specifies whether the data value is present in the document. true specifies that the value is valid. For example, if the “Title” element was not populated in the document, getIsValid would return false.

isDateTimeType()

Determines whether the metadata element is of date/time type.

getDateTime()

Gets the date and time in the form of a string. If the metadata element is of KV_DateTime type, call this method to get the date and time in the form of a string, for example “Wed Jun 30 21:49:08 1993” or “135 Minutes”.

getData()

Gets the content of the element.

If type is KV_Int4 or KV_Bool, data contains the actual value. Otherwise, data is a pointer to the actual value.

KV_DateTime and KV_IEEE8 point to an 8-byte value.

KV_String and KV_Unicode point to the beginning of the string that contains the text. KV_Unicode is replaced with KV_String when the UNICODE value has been character mapped to the desired output character set.


_HP_HTML5_bannerTitle.htm