// create temporary storage based on arbitrary medium // after such a storage is closed it is lost
Object oTempStorage = m_xStorageFactory.createInstance();
XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage ); if ( xTempStorage == null )
{
m_aTestHelper.Error( "Can't create temporary storage representation!" ); returnfalse;
}
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes // the stream will not be encrypted if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", false, pBytes, sPass1 ) ) returnfalse; if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "BigSubStream1", "MediaType1", false, pBigBytes, sPass1 ) ) returnfalse;
// create temporary storage based on a previously created temporary file
Object pArgs[] = new Object[2];
pArgs[0] = (Object) sTempFileURL;
pArgs[1] = Integer.valueOf( ElementModes.WRITE );
// copy xTempStorage to xTempFileStorage // xTempFileStorage will be automatically committed if ( !m_aTestHelper.copyStorage( xTempStorage, xTempFileStorage ) ) returnfalse;
// change password of the substream of new storage based on file int nResult = m_aTestHelper.ChangeStreamPass( xTempFileStorage, "SubStream1", sPass1, sPass2 ); if ( nResult == 0 ) returnfalse; // test failed elseif ( nResult == -1 ) returntrue; // tested optional feature is not supported
// change password of the substream of new storage based on file
nResult = m_aTestHelper.ChangeStreamPass( xTempFileStorage, "BigSubStream1", sPass1, sPass2 ); if ( nResult == 0 ) returnfalse; // test failed elseif ( nResult == -1 ) returntrue; // tested optional feature is not supported
if ( !m_aTestHelper.commitStorage( xTempFileStorage ) ) returnfalse;
// dispose used storages to free resources if ( !m_aTestHelper.disposeStorage( xTempStorage ) || !m_aTestHelper.disposeStorage( xTempFileStorage ) ) returnfalse;
// now check all the written and copied information
// the temporary file must not be locked any more after storage disposing
pArgs[1] = Integer.valueOf( ElementModes.READ );
Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); if ( xResultStorage == null )
{
m_aTestHelper.Error( "Can't reopen storage based on temporary file!" ); returnfalse;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.