com.groupdocs.redaction.integration

Class DocumentFormatInstance



  • public abstract class DocumentFormatInstance
    extends Object

    Represents a specific format of a document. Implement this class to add your own document types.

    • Constructor Detail

      • DocumentFormatInstance

        public DocumentFormatInstance()
    • Method Detail

      • getPassword

        public final String getPassword()

        Gets a password for password protected documents.

        Returns:
        A password for password protected documents.
      • setPassword

        public final void setPassword(String value)

        Sets a password for password protected documents.

        Parameters:
        value - A password for password protected documents.
      • isAccessGranted

        public final boolean isAccessGranted()
      • initialize

        public void initialize(DocumentFormatConfiguration config)

        Performs initialization of the instance of document format handler.

        Parameters:
        config - Format configuration
      • load

        public void load(InputStream input)
                  throws Exception

        Loads the document from a stream.

        Parameters:
        input - Stream to read from
        Throws:
        Exception
      • save

        public abstract void save(OutputStream output)
                           throws Exception

        Saves the document to a stream.

        Parameters:
        output - Target stream to save the document
        Throws:
        java.lang.Exception;
        Exception
      • setAccessGranted

        protected final void setAccessGranted(boolean isGranted)

        Sets a validation status, if the document requires password.

        Parameters:
        isGranted - True, if password is correct
      • performBinaryCheck

        public boolean performBinaryCheck(InputStream input)
                                   throws Exception

        Checks if the given stream contains a document, supported by this format instance.

        Parameters:
        input - Document content stream
        Returns:
        True, if the document can be loaded by this format instance and false otherwise
        Throws:
        Exception
      • getDefaultConfiguration

        public static RedactorConfiguration getDefaultConfiguration()

        Provides a singleton instance with default configuration of built-in formats.

        Returns:
        Configuration instance