com.aspose.slides

Interfaces

Classes

Exceptions

com.aspose.slides

Class LoadingStreamBehavior

  • java.lang.Object
    • com.aspose.ms.System.ValueType<com.aspose.ms.System.Enum>
      • com.aspose.ms.System.Enum
        • com.aspose.slides.LoadingStreamBehavior


  • public final class LoadingStreamBehavior
    extends com.aspose.ms.System.Enum

    The InputStream passed to a method is considered as a Binary Large Object (BLOB) (see IBlobManagementOptions description). Values of this enumeration identify how the InputStream should be treated when it passed to the method. Depending on the requirements, different decisions could be made to provide the most efficient behavior.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.aspose.ms.System.Enum

        com.aspose.ms.System.Enum.AbstractEnum, com.aspose.ms.System.Enum.FlaggedEnum, com.aspose.ms.System.Enum.ObjectEnum, com.aspose.ms.System.Enum.SimpleEnum
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int KeepLocked
      The stream will be locked inside the IPresentation object, i.e.
      static int ReadStreamAndRelease
      The stream will be read to the end and then released - i.e.
      • Fields inherited from class com.aspose.ms.System.Enum

        EnumSeparatorCharArray
    • Method Summary

      • Methods inherited from class com.aspose.ms.System.Enum

        Clone, CloneTo, format, format, get_Caption, get_Value, getName, getName, getNames, getNames, getUnderlyingType, getUnderlyingType, getValue, getValues, isDefined, isDefined, isDefined, isDefined, parse, parse, parse, parse, register, toObject, toString
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ReadStreamAndRelease

        public static final int ReadStreamAndRelease

        The stream will be read to the end and then released - i.e. it will be guaranteed that this stream will not be used by IPresentation instance in the future. It can be closed by the client code or used in any other way.


         
         Presentation pres = new Presentation();
         try {
           FileInputStream fileStream = new FileInputStream(new File("video.avi"));
           pres.getVideos().addVideo(fileStream, LoadingStreamBehavior.ReadStreamAndRelease);
           fileStream.close(); // the stream can be closed, it's no longer needed for the "pres" object.
         } finally {
           if (pres != null) pres.dispose();
         }
         
        See Also:
        Constant Field Values
      • KeepLocked

        public static final int KeepLocked

        The stream will be locked inside the IPresentation object, i.e. the ownership of the stream will be transferred. The IPresentation object will be responsible to correctly dispose the stream when this object will be disposed itself. This behavior is extremely useful when you need to serialize a large BLOB file (such as a large video or audio -see IBlobManagementOptions description) and want to prevent loading this file into memory or other performance issues. You may just open the FileInputStream for this file and pass to a method, choosing KeepLocked LoadingStreamBehavior.


         
         Presentation pres = new Presentation();
         try {
           FileStream fileStream = new FileStream("Huge Monster Sized Video.avi", FileMode.Open);
           pres.getVideos().addVideo(fileStream, LoadingStreamBehavior.KeepLocked);
           // fileStream.close(); // You should not close the stream or interact with it in any other way, it will lead to an error in Save method.
           // The fileStream will be used for saving, what will prevent high memory consumption
           pres.save("My Presentation With Huge Monster Sized Video.pptx", SaveFormat.Pptx);
         } finally {
           if (pres != null) pres.dispose();
         }
         
        See Also:
        Constant Field Values