com.jniwrapper.win32.stg
Class StorageFunctions

java.lang.Object
  extended bycom.jniwrapper.win32.stg.StorageFunctions

public class StorageFunctions
extends java.lang.Object

This class provides functions for working with Structured Storage objects.


Constructor Summary
StorageFunctions()
           
 
Method Summary
static ILockBytes createILockBytesOnHGlobal(GlobalMemoryBlock global, boolean deleteOnRelease)
          Creates a byte array object that allows you to use global memory as the physical device underneath a compound file implementation.
static IStream createStreamOnHGlobal(GlobalMemoryBlock global, boolean deleteOnRelease)
          Creates a stream object stored in global memory.
static GlobalMemoryBlock getGlobalFromILockBytes(ILockBytes lockBytes)
          Retrieves a global memory handle to a byte array object created using the CreateILockBytesOnHGlobal function.
static CLSID readClassStg(IStorage pStg)
           
static CLSID readClassStm(IStream pStg)
           
static IStorage stgCreateDocfile(BStr pwcsName, StgMode grfMode, Int32 reserved)
           
static IStorage stgCreateDocfileOnILockBytes(ILockBytes plkbyt, StgMode grfMode, Int32 reserved)
           
static IStorage stgCreateStorageEx(BStr pwcsName, StgMode grfMode, StgFmt stgfmt, UInt32 grfAttrs, StgOptions stgOptions, Pointer.Void reserved2, IID iid)
           
static boolean stgIsStorageFile(java.lang.String lpwcsFileName)
           
static Int32 stgIsStorageILockBytes(ILockBytes plkbyt)
           
static IStorage stgOpenStorage(java.lang.String pwcsName, IStorage pstgPriority, StgMode grfMode, BStr snbExclude)
           
static IStorage stgOpenStorageEx(BStr pwcsName, StgMode grfMode, StgFmt stgfmt, UInt32 grfAttrs, StgOptions stgOptions, Pointer.Void reserved2, IID iid)
           
static IStorage stgOpenStorageOnILockBytes(ILockBytes plkbyt, IStorage pstgPriority, StgMode grfMode, BStr snbExclude, Int32 reserved)
           
static void writeClassStg(IStorage pStg, CLSID rclsid)
           
static void writeClassStm(IStream pStg, CLSID rclsid)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageFunctions

public StorageFunctions()
Method Detail

stgIsStorageFile

public static boolean stgIsStorageFile(java.lang.String lpwcsFileName)
                                throws ComException,
                                       java.io.IOException
Parameters:
lpwcsFileName - [in]
Throws:
ComException
java.io.IOException

stgOpenStorage

public static IStorage stgOpenStorage(java.lang.String pwcsName,
                                      IStorage pstgPriority,
                                      StgMode grfMode,
                                      BStr snbExclude)
                               throws ComException
Parameters:
pwcsName - [in]
pstgPriority - [in]
grfMode - [in]
snbExclude - [in]
Throws:
ComException

stgCreateStorageEx

public static IStorage stgCreateStorageEx(BStr pwcsName,
                                          StgMode grfMode,
                                          StgFmt stgfmt,
                                          UInt32 grfAttrs,
                                          StgOptions stgOptions,
                                          Pointer.Void reserved2,
                                          IID iid)
                                   throws ComException
Parameters:
pwcsName - [in]
grfMode - [in]
stgfmt - [in]
grfAttrs - [in]
stgOptions - [in]
reserved2 - [in]
iid - [in]
Throws:
ComException

stgOpenStorageEx

public static IStorage stgOpenStorageEx(BStr pwcsName,
                                        StgMode grfMode,
                                        StgFmt stgfmt,
                                        UInt32 grfAttrs,
                                        StgOptions stgOptions,
                                        Pointer.Void reserved2,
                                        IID iid)
                                 throws ComException
Parameters:
pwcsName - [in]
grfMode - [in]
stgfmt - [in]
grfAttrs - [in]
stgOptions - [in]
reserved2 - [in]
iid - [in]
Throws:
ComException

stgCreateDocfile

public static IStorage stgCreateDocfile(BStr pwcsName,
                                        StgMode grfMode,
                                        Int32 reserved)
                                 throws ComException
Parameters:
pwcsName - [in]
grfMode - [in]
reserved - [in]

Note. You should call IStorage.release() manually after working with created object

Throws:
ComException

getGlobalFromILockBytes

public static GlobalMemoryBlock getGlobalFromILockBytes(ILockBytes lockBytes)
                                                 throws ComException
Retrieves a global memory handle to a byte array object created using the CreateILockBytesOnHGlobal function.

Parameters:
lockBytes - the ILockBytes interface on the byte-array object previously created by a call to the CreateILockBytesOnHGlobal function.
Returns:
memory handle used by the specified byte-array object.
Throws:
ComException

createILockBytesOnHGlobal

public static ILockBytes createILockBytesOnHGlobal(GlobalMemoryBlock global,
                                                   boolean deleteOnRelease)
                                            throws ComException
Creates a byte array object that allows you to use global memory as the physical device underneath a compound file implementation.

Parameters:
global - Memory handle.
deleteOnRelease - Determines whether the underlying handle for this byte array object should be automatically freed when the object is released.
Throws:
ComException

createStreamOnHGlobal

public static IStream createStreamOnHGlobal(GlobalMemoryBlock global,
                                            boolean deleteOnRelease)
                                     throws ComException
Creates a stream object stored in global memory.

Parameters:
global - Memory handle allocated by the GlobalAlloc function.
deleteOnRelease - Whether the underlying handle for this stream object should be automatically freed when the stream object is released.
Returns:
the interface pointer to the new stream object.
Throws:
ComException

stgCreateDocfileOnILockBytes

public static IStorage stgCreateDocfileOnILockBytes(ILockBytes plkbyt,
                                                    StgMode grfMode,
                                                    Int32 reserved)
                                             throws ComException
Parameters:
plkbyt - [in]
grfMode - [in]
reserved - [in]
Throws:
ComException

stgOpenStorageOnILockBytes

public static IStorage stgOpenStorageOnILockBytes(ILockBytes plkbyt,
                                                  IStorage pstgPriority,
                                                  StgMode grfMode,
                                                  BStr snbExclude,
                                                  Int32 reserved)
                                           throws ComException
Parameters:
plkbyt - [in]
pstgPriority - [in]
grfMode - [in]
snbExclude - [in]
reserved - [in]
Throws:
ComException

stgIsStorageILockBytes

public static Int32 stgIsStorageILockBytes(ILockBytes plkbyt)
Parameters:
plkbyt - [in]

readClassStg

public static CLSID readClassStg(IStorage pStg)
                          throws ComException
Parameters:
pStg - [in]
Throws:
ComException

writeClassStg

public static void writeClassStg(IStorage pStg,
                                 CLSID rclsid)
                          throws ComException
Parameters:
pStg - [in]
rclsid - [in]
Throws:
ComException

readClassStm

public static CLSID readClassStm(IStream pStg)
                          throws ComException
Parameters:
pStg - [in]
Throws:
ComException

writeClassStm

public static void writeClassStm(IStream pStg,
                                 CLSID rclsid)
                          throws ComException
Parameters:
pStg - [in]
rclsid - [in]
Throws:
ComException