Skip to main content

HashAlgorithmType Enum

Lists values that specify the the hash algorithm that the Presentation API uses for write protection.

Declaration

public enum HashAlgorithmType extends Enum<HashAlgorithmType> implements IIntEnum

Members

Name Description
SHA256

The SHA-256 hash algorithm.

SHA384

The SHA-384 hash algorithm.

SHA512

The SHA-512 hash algorithm.

fromValue(int value)

Returns the enum item with the specified integer value.

getName()

Returns the enum item name.

getValue()

Returns the integer value.

toString()

Returns the string representation.

valueOf(String name)

Returns the enum constant with the specified name.

values()

Returns available constants.

Remarks

The following code snippet applies password-based write protection:

package presentation;

import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;

import java.io.*;
import java.nio.file.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try(Presentation presentation =
                    new Presentation(
                            Files.readAllBytes(
                                    Path.of("Presentation.pptx")))) {

            // Enable write protection.
            WriteProtectionOptions options =
                    new WriteProtectionOptions("password", HashAlgorithmType.SHA512);

            presentation.protect(options);

            Path outputDir = Path.of("output");
            Files.createDirectories(outputDir);

            // Save the protected presentation.
            try (FileOutputStream fileStream = new FileOutputStream(
                    outputDir.resolve("ProtectedPresentation.pptx").toFile())) {

                presentation.saveDocument(fileStream);
            }
        }
    }
}

Refer to the following help topic for additional information: Protect a Presentation from Editing.

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
java.lang.Enum
HashAlgorithmType