/// <summary> ///Creates a Generic Stream object with user supplied callbacks. This is the most complex way of using ///a GenericStream and will require the user to implement more of the functionality normally handled by ///the standard callbacks. In particular Marker Support will require the user to make their transfer ///method "rewindable" for up to 100MB of previously transferred data. See API Guide: FPStream_CreateGenericStream ///See API Guide: FPStream_CreateGenericStream /// ///@param direction Indicator for the type of GenericStream that is to be created i.e. input to /// Centera or output from Centera. ///@param userCBS Callbacks provided by the user. Typically the derived class will only /// require to override PopulateBuffer and / or ProcessReturnedData. ///@param userData An IntPtr which can be used to reference a user object that may be required /// when working with the input or output data buffer. /// </summary> public FPGenericStream(StreamDirection direction, FPStreamCallbacks userCBS, IntPtr userData) { prepare = new FPCallback(userCBS.PrepareBuffer); complete = new FPCallback(userCBS.BlockTransferred); mark = new FPCallback(userCBS.SetMark); reset = new FPCallback(userCBS.ResetMark); close = new FPCallback(userCBS.TransferComplete); if (direction == StreamDirection.InputToCentera) { theStream = SDK.FPStream_CreateGenericStream(prepare, complete, mark, reset, close, userData); } else { theStream = SDK.FPStream_CreateGenericStream(null, complete, mark, reset, close, userData); } AddObject(theStream, this); userCBS.StreamRef = theStream; userStream = userCBS.userStream; unsafe { theInfo = SDK.FPStream_GetInfo(theStream); theInfo->mAtEOF = 0; theInfo->mStreamLen = -1; theInfo->mTransferLen = 0; theInfo->mStreamPos = 0; theInfo->mMarkerPos = 0; theInfo->mBuffer = null; theInfo->mReadFlag = (byte)direction; } }
public static extern FPStreamRef FPStream_CreateGenericStream(FPCallback prepareProc, FPCallback completeProc, FPCallback setMarkerProc, FPCallback resetMarkerProc, FPCallback closeProc, IntPtr userData);