com.groupdocs.metadata

Interfaces

Classes

Exceptions

com.groupdocs.metadata

Class MetadataUtility



  • public class MetadataUtility
    extends Object

    Represents different utilities classes for working with metadata.

    • Constructor Detail

      • MetadataUtility

        public MetadataUtility()
    • Method Detail

      • extractMetadata

        public static Metadata[] extractMetadata(InputStream stream)

        Gets array of Metadata from the Stream.

        Parameters:
        stream - File stream.
        Returns:
        Array of Metadata presented in file.
        Throws:
        ArgumentNullException - Stream could not be null.
      • extractMetadata

        public static Metadata[] extractMetadata(String path)

        Gets array of Metadata from existing file.

        Parameters:
        path - Absolute path to file.
        Returns:
        Array of Metadata presented in file.
        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • beginExtractMetadata

        public static com.aspose.ms.System.IAsyncResult beginExtractMetadata(String path)

        Begins the extract metadata.

        Parameters:
        path - Absolute path to the file.
        Returns:
        IAsyncResult.
      • endExtractMetadata

        public static Metadata[] endExtractMetadata(com.aspose.ms.System.IAsyncResult asyncResult)

        Ends the extract metadata.

        Parameters:
        asyncResult - The asynchronous result.
        Returns:
        Array of Metadata.
        Throws:
        ArgumentNullException - Could not be null.
        com.aspose.ms.System.InvalidOperationException - Invalid token.
      • extractSpecificMetadata

        public static Metadata extractSpecificMetadata(InputStream stream,
                                       int metadataType)

        Extracts specific Metadata from the Stream.

        Parameters:
        stream - File stream.
        metadataType - Type of the metadata.
        Returns:
        Metadata if metadata found in file; otherwise null.
        Throws:
        ArgumentNullException - Stream could not be null.
      • extractSpecificMetadata

        public static Metadata extractSpecificMetadata(String path,
                                       int metadataType)

        Extracts specific Metadata from the file.

        Parameters:
        path - Absolute path to the file.
        metadataType - Type of the metadata.
        Returns:
        Metadata if metadata found in file; otherwise null.
        Throws:
        ArgumentNullException - Could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • extractDocumentProperties

        public static MetadataPropertyCollection extractDocumentProperties(InputStream stream)

        Gets document properties from the Stream.

        Parameters:
        stream - File stream.
        Returns:
        MetadataPropertyCollection presented in file.
        Throws:
        ArgumentNullException - Stream could not be null.
      • extractDocumentProperties

        public static MetadataPropertyCollection extractDocumentProperties(String path)

        Gets document properties from existing file.

        Parameters:
        path - Absolute path to file.
        Returns:
        MetadataPropertyCollection presented in file.
        Throws:
        ArgumentNullException - Could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • extractXmpPackage

        public static XmpPacketWrapper extractXmpPackage(InputStream stream)

        Extracts XmpPacketWrapper from the Stream.

        Parameters:
        stream - File stream.
        Returns:
        XmpPacketWrapper if metadata found; otherwise null.
        Throws:
        ArgumentNullException - Stream could not be null.
      • extractXmpPackage

        public static XmpPacketWrapper extractXmpPackage(String path)

        Extracts XmpPacketWrapper from the existing path.

        Parameters:
        path - Absolute path to file.
        Returns:
        XmpPacketWrapper if metadata found; otherwise null.
        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • extractXmpProperties

        public static XmpProperties extractXmpProperties(InputStream stream)

        Extracts XmpProperties from the Stream.

        Parameters:
        stream - File stream.
        Returns:
        XmpProperties if metadata found; otherwise null.
        Throws:
        ArgumentNullException - Stream could not be null.
      • extractXmpProperties

        public static XmpProperties extractXmpProperties(String path)

        Extracts XmpProperties from the existing path.

        Parameters:
        path - Absolute path to file.
        Returns:
        XmpProperties if metadata found; otherwise null.
        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • cleanMetadata

        public static void cleanMetadata(InputStream stream)

        Removes all metadata from the Stream.

        Parameters:
        stream - File stream.


        This feature is not available in trial mode.

      • cleanMetadata

        public static void cleanMetadata(String path)

        Removes all metadata from the file.

        Parameters:
        path - Absolute path to the file.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • beginUpdateMetadata

        public static com.aspose.ms.System.IAsyncResult beginUpdateMetadata(String path,
                                                            Metadata[] metadataArray)

        Begins the update metadata.

        Parameters:
        path - Absolute path to file.
        metadataArray - The metadata array.
        Returns:
        IAsyncResult.
      • endUpdateMetadata

        public static void endUpdateMetadata(com.aspose.ms.System.IAsyncResult asyncResult)

        Ends the update metadata.

        Parameters:
        asyncResult - The asynchronous result.
        Throws:
        ArgumentNullException - IAsyncResult could not be null.
        com.aspose.ms.System.InvalidOperationException - Invalid token.
      • updateMetadata

        public static void updateMetadata(InputStream stream,
                          Metadata[] metadataArray)

        Updates array in the Stream.

        Parameters:
        stream - The stream.
        metadataArray - The metadata array.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Stream could not be null.
      • updateMetadata

        public static void updateMetadata(String path,
                          Metadata[] metadataArray)

        Updates the metadata.

        Parameters:
        path - Absolute path to the updating file.
        metadataArray - Array of Metadata.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • updateMetadata

        public static void updateMetadata(String path,
                          Metadata[] metadataArray,
                          String destinationPath)

        Updates the metadata.

        Parameters:
        path - Absolute path to the updating file.
        metadataArray - Array of Metadata.
        destinationPath - Absolute path to the resulting file. If null - option is skipped.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • updateMetadata

        public static void updateMetadata(InputStream stream,
                          Metadata metadata)

        Updates metadata in the Stream.

        Parameters:
        stream - The stream.
        metadata - Instance of Metadata.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Stream could not be null.
      • updateMetadata

        public static void updateMetadata(String path,
                          Metadata metadata)

        Updates the metadata.

        Parameters:
        path - Absolute path to the updating file.
        metadata - Instance of Metadata.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • updateMetadata

        public static void updateMetadata(String path,
                          Metadata metadata,
                          String destinationPath)

        Updates the metadata.

        Parameters:
        path - Absolute path to the updating file.
        metadata - Instance of Metadata.
        destinationPath - Absolute path to the resulting file. If null - option is skipped.


        This feature is not available in trial mode.

        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • compareDoc

        @Deprecated
        public static MetadataPropertyCollection compareDoc(String path1,
                                                       String path2)
        Deprecated. 

        Compares Word documents and returns differences.

        Parameters:
        path1 - Absolute path to the Word document.
        path2 - Absolute path to the compared document.


        This feature is not available in trial mode.

        Returns:
        Returns differences.
      • comparePdf

        @Deprecated
        public static MetadataPropertyCollection comparePdf(String path1,
                                                       String path2)
        Deprecated. 

        Compares PDF documents and returns differences.

        Parameters:
        path1 - Absolute path to the PDF document.
        path2 - Absolute path to the compared document.


        This feature is not available in trial mode.

        Returns:
        Returns differences.
      • comparePpt

        @Deprecated
        public static MetadataPropertyCollection comparePpt(String path1,
                                                       String path2)
        Deprecated. 

        Compares PowerPoint documents and returns differences.

        Parameters:
        path1 - Absolute path to the PowerPoint document.
        path2 - Absolute path to the compared document.


        This feature is not available in trial mode.

        Returns:
        Returns differences.
      • compareXls

        @Deprecated
        public static MetadataPropertyCollection compareXls(String path1,
                                                       String path2)
        Deprecated. 

        Compares XlsFormat documents and returns differences.

        Parameters:
        path1 - Absolute path to the Excel document.
        path2 - Absolute path to the compared document.


        This feature is not available in trial mode.

        Returns:
        Returns differences.
      • isProtected

        public static boolean isProtected(String path)

        Determines whether the specified document is protected by password.

        Parameters:
        path - Absolute path to the document.
        Returns:
        true if document is protected by password; otherwise false.
        Throws:
        ArgumentNullException - Path could not be null.
        com.aspose.ms.System.IO.FileNotFoundException - Requested file not found.
      • isProtected

        public static boolean isProtected(InputStream stream)

        Determines whether the specified document is protected by password.

        Parameters:
        stream - Document stream.
        Returns:
        true if document is protected by password.
        Throws:
        ArgumentNullException - Stream could not be null.
      • getMimeType

        public static String getMimeType(String path)

        Gets MIME type of the specific file.

        Parameters:
        path - Absolute path to the file.
        Returns:
        MIME type.
      • getMimeType

        public static String getMimeType(InputStream stream)

        Gets MIME type of the stream.

        Parameters:
        stream - File stream.
        Returns:
        MIME type.