Solid File System

Virtual file system enigne that can be embedded into your software.

OnDataDecompress event/delegate/callback

Filter:

Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    

Overview

This event is fired when custom compression is used and data block must be decompressed.

Declaration

[Pascal]
    TSolFSDecompressDataEvent = procedure( Sender : TObject; InData : Pointer; InSize : LongWord; OutData : Pointer; var OutSize : LongWord; var Result : LongInt) of object;

[Plain C]
    typedef Error (__stdcall *SolFSDecompressDataFunc)( LongWord UserData, void * InData, unsigned long InSize, void * OutData, unsigned long * OutSize);

[C++ (DLL/Lib)]
    typedef Error (__stdcall *SolFSDecompressDataFunc)( LongWord UserData, void * InData, unsigned long InSize, void * OutData, unsigned long * OutSize);

[C++ (VCL)]
    typedef void (__closure *TSolFSDecompressDataEvent)( System::TObject* Sender, void * InData, unsigned long InSize, void * OutData, unsigned long OutSize, unsigned long & Result);

[C++ (.NET)]
    public __delegate void SolFSDecompressDataEvent( SolFSStorage* Sender, unsigned char inData __gc[], unsigned char outData __gc[], Int32 __gc &outSize, Int32 __gc &result);

[C#]
    public void SolFSDecompressDataEvent( SolFS.SolFSStorage Sender, uchar[] inData, uchar[] outData, ref int outSize, ref int result);

[VB.NET]
    Sub SolFSDecompressDataEvent( ByVal Sender As SolFS.SolFSStorage, ByVal inData As Byte(), ByVal outData As Byte(), ByRef outSize As Int32, ByRef Result As Int32)

[Java]
    byte[] ISolFSCompressionEvents.onDataDecompress(byte[] inData)

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • InData - buffer with data to be decompressed
  • InSize - length of the incoming buffer
  • OutData - the buffer for decompressed data
  • OutSize - actual size of decompressed data (see description)
  • Result - out parameter (return value for DLL) where the application places the result of the operation. If you are working with file system, Win32 error code is a good candidate for placing to Result parameter. Otherwise you can use any other error codes, just be sure that 0 means success.
    [Java]See Description for details about error reporting in Java.

  • [Plain C] UserData - application-defined parameter which is specified when creating the storage and passed back to callback function.

[Java]  Return values

The buffer which contains the decompressed data.

Description

The event is fired when custom compression is used and the data block must be decompressed. Data to decompress is put to InData parameter. The size of the incoming data is placed to InSize. The event handler should put the result of decompression to the buffer referenced by OutData parameter. OutSize should be set to the number of bytes, put to OutData parameter.

The callback/event handler must be set before the storage is opened.

[Java]
You need to implement ISolFSCompressionEvents interface in your code and pass the object, that implements the events, to one of SolFSStorage constructors that accept storageEvents parameter.

[Java]
ERROR REPORTING: In Java you can't return more than one parameter, so the natural way is to throw an exception. You can throw any exception, and this exception will be passed back to the code, which called one of SolFS functions. So if you use callback mechanism and throw exception from within event handlers, be sure to wrap each call to SolFS methods with try/catch.

See also

Information about callbacks (Operating System edition only)     OnDataCompress    

Back to top