void CDeploymentComponentData::ConstructLoadL(RReadStream &aStream) { TUint32 len(aStream.ReadUint32L() ); aStream.ReadL(iDataFileName, len); len = aStream.ReadUint32L(); aStream.ReadL(iMimeType, len); }
/** Intended Usage : Restore the internal state from aStream. Error Condition : Leave with the error code. @leave KErrNoMemory. @leave @see RReadStream. @since 7.0 @param aClientSide a boolean indicating whether the streaming is to performed in client/server side @param aStream The stream to read the data from. @pre CImplementationInformation is fully constructed. @post CImplementationInformation is restored to the state specified by the contents of aStream. */ void CImplementationInformation::InternalizeL(TBool aClientSide,RReadStream& aStream) { delete iDisplayName; iDisplayName = NULL; delete iData; iData = NULL; delete iOpaqueData; iOpaqueData = NULL; iImplementationUid.iUid = aStream.ReadInt32L(); iVersion = aStream.ReadInt32L(); TInt inputLength = aStream.ReadInt32L(); if(inputLength > 0) { // read in the iName string iDisplayName = HBufC::NewL(inputLength); TPtr inputBuf = iDisplayName->Des(); aStream.ReadL(inputBuf,inputLength); } inputLength = aStream.ReadInt32L(); if(inputLength > 0) { // read in the iData string iData = HBufC8::NewL(inputLength); TPtr8 inputBuf = iData->Des(); aStream.ReadL(inputBuf,inputLength); } inputLength = aStream.ReadInt32L(); if(inputLength > 0) { // read in the iOpaqueData string iOpaqueData = HBufC8::NewL(inputLength); TPtr8 inputBuf = iOpaqueData->Des(); aStream.ReadL(inputBuf,inputLength); } if (aClientSide) { TUint checkDrive = aStream.ReadInt32L(); if (checkDrive > (TUint) KMaxDrives) User::Leave(KErrCorrupt); iDrive = checkDrive; iVid.iId = aStream.ReadInt32L(); } TInt8 additionalImplInfo=aStream.ReadInt8L(); iRomOnly=additionalImplInfo&1; iRomBased=(additionalImplInfo&2)>>1; iDisabled=(additionalImplInfo&4)>>2; TInt count = aStream.ReadInt32L(); if (count != KNoneExtendedInterface) { for(TInt i = 0; i < count; i++) { AddExtendedInterfaceL(TUid::Uid(aStream.ReadInt32L())); } } }
// ----------------------------------------------------------------------------- // CHttpCacheEntry::InternalizeL // // ----------------------------------------------------------------------------- // void CHttpCacheEntry::InternalizeL( RReadStream& aReadStream, const TDesC& aDirectory ) { // url length TInt len; len = aReadStream.ReadInt32L(); delete iUrl; iUrl=NULL; iUrl = HBufC8::NewL( len ); TPtr8 ptr8( iUrl->Des() ); // url aReadStream.ReadL( ptr8, len ); // calculate full path and filename length // aDirectory/ + "x/xxxxxxxx" : note aDirectory has trailing '/' len = aDirectory.Length() + KSubdirNameLength + KFilenameLength; HBufC* filename = HBufC::NewLC( len ); TPtr ptr( filename->Des() ); // Read max char length of filename. // NOTE: The filename and filename length is calculated by the code in // HttpCacheUtil::GenerateNameLC. The sub directory is the same as the // last char of the filename, e.g. ..\A\0123DCBA TBuf<KFilenameLength> uniqueFilename; aReadStream.ReadL( uniqueFilename , KFilenameLength ); TPtrC uniqueSubDir = uniqueFilename.Right(1); // assemble path and filename ptr.Format(_L("%S%S\\%S"), &aDirectory, &uniqueSubDir, &uniqueFilename); // SetFileNameL( filename->Des() ); // CleanupStack::PopAndDestroy(); // filename // la TReal64 la; la = aReadStream.ReadReal64L(); iLastAccessed = la; // ref iRef = aReadStream.ReadUint32L(); // size iBodySize = aReadStream.ReadUint32L( ); // size iHeaderSize = aReadStream.ReadUint32L( ); // protected iProtected = aReadStream.ReadInt32L(); // header data delete iHeaderBuffer; iHeaderBuffer = NULL; len = aReadStream.ReadInt32L(); iHeaderBuffer = HBufC8::NewL(len); TPtr8 header_ptr( iHeaderBuffer->Des() ); aReadStream.ReadL( header_ptr, len ); // SetState( ECacheComplete ); }
// // Test reading from a store // // Test that the data in a stream is the same as the data the // testWriteL() function writes to the first stream. // LOCAL_C void testReadL(RReadStream& aStream) { for (TInt i=KTestLength;i>=0;--i) { aStream.ReadL(TheBuf,i); test(TheBuf.Length()==i); TheBuf.SetMax(); aStream.ReadL(&TheBuf[i],KTestLength-i); TheBuf.SetLength(KTestLength); test(TheBuf==KTestDes); } }
/** @SYMTestCaseID SYSLIB-STORE-CT-1148 @SYMTestCaseDesc Reading from a stream test @SYMTestPriority High @SYMTestActions Attempt for reading data from a stream @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void testReadL(RReadStream& aStream) { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1148 ")); for (TInt i=KTestLength;i>=0;--i) { aStream.ReadL(TheBuf,i); test(TheBuf.Length()==i); TheBuf.SetMax(); aStream.ReadL(&TheBuf[i],KTestLength-i); TheBuf.SetLength(KTestLength); test(TheBuf==KTestDes); } }
void CQueueEntry::InternalizeL( RReadStream& aStream ) { TInt size; RBuf text; CleanupClosePushL( text ); RBuf8 text8; CleanupClosePushL( text8 ); size = aStream.ReadInt32L( ); text.ReAllocL( size ); aStream.ReadL( text, size ); SetUrlL(text); size = aStream.ReadInt32L( ); if( size > text.Length() ) text.ReAllocL( size ); aStream.ReadL( text, size ); SetTitleL(text); size = aStream.ReadInt32L( ); if( size > text.Length() ) text.ReAllocL( size ); aStream.ReadL( text, size ); SetTagsL(text); size = aStream.ReadInt32L( ); if( size > text.Length() ) text.ReAllocL( size ); aStream.ReadL( text, size ); SetDescriptionL( text ); size = aStream.ReadInt32L( ); if( size > text.Length() ) text.ReAllocL( size ); aStream.ReadL( text, size ); SetFilename( text ); CleanupStack::PopAndDestroy( &text8 ); CleanupStack::PopAndDestroy( &text ); iType = (TEntryType) aStream.ReadInt32L( ); iStatus = (TEntryStatus) aStream.ReadInt32L( ); iCategory = (TMovieCategory) aStream.ReadInt32L( ); iPublic = aStream.ReadInt32L( ); iSize = aStream.ReadInt32L( ); iUid = aStream.ReadInt32L( ); }
// --------------------------------------------------------------------------- -- // CDRMEventModify::Internalize // Reads the data of the object from the given stream // (other items were commented in a header). // ----------------------------------------------------------------------------- // EXPORT_C void CDRMEventModify::InternalizeL( RReadStream& aInput) { TInt inputLength = 0; MDRMEvent::InternalizeL(aInput); // Read the length of the HBufC8* inputLength = aInput.ReadInt32L(); // Reserve the HBufC8* if( !iContentID ) { iContentID = HBufC8::NewL(inputLength); } else { iContentID->ReAllocL(inputLength); } // Read the HBufC8* TPtr8 inRead(iContentID->Des()); aInput.ReadL(inRead,inputLength); // this implementation may need to be changed if the size of the enum changes iUniqueID = aInput.ReadUint32L(); };
void TTcSettings::doLoadL( RReadStream& aStream ) { // Check that the file is of correct version TInt version = aStream.ReadInt16L(); if( version == KTcSettingsVersion ) { // Read bearer selection iBearerType = aStream.ReadInt32L() ; // Read autoconnect selection iAutoConnect = aStream.ReadInt16L(); // Read TCP port selection iTCPPort = aStream.ReadInt16L(); // Read IAP Id iIAPId = aStream.ReadInt16L(); // Read CSY name iCSYName = aStream.ReadInt32L(); // Read comms port name iCommPort = aStream.ReadInt32L(); // Read baudrate of comms iBaudrate = aStream.ReadInt32L(); // Read first run flag iIsFirstRun = aStream.ReadInt16L(); // Read remote TCP address as string // Read length first TUint16 length = aStream.ReadInt16L(); TBuf<40> buf; aStream.ReadL( buf, length); iTCPRemoteAddr.Input(buf); } }
EXPORT_C void CX509Certificate::InternalizeL(RReadStream& aStream) { if (iIssuerName != NULL) //just to check cert is uninitialised { User::Leave(KErrArgument); } iKeyFactory = new(ELeave) TX509KeyFactory; TInt len = aStream.ReadInt32L(); //Read the length of the streamed encoding HBufC8* temp= HBufC8::NewLC(len); TPtr8 ptr=temp->Des(); aStream.ReadL(ptr,len); iEncoding=temp->AllocL(); CleanupStack::PopAndDestroy(); // temp TASN1DecSequence encSeq; TInt pos = 0; CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3); TASN1DecGeneric* encSigAlg = seq->At(1); iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(encSigAlg->Encoding()); TASN1DecBitString encBS; iSignature = encBS.ExtractOctetStringL(*(seq->At(2))); CleanupStack::PopAndDestroy();//seq CSHA1* hash = CSHA1::NewL(); CleanupStack::PushL(hash); iFingerprint = hash->Final(Encoding()).AllocL(); CleanupStack::PopAndDestroy();//hash ConstructCertL(); }
void readFromStreamLX(QMimeData* aData,RReadStream& aStream) { // This function both leaves and throws exceptions. There must be no destructor // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; aStream >> mimeTypeCount; for (int i = 0; i< mimeTypeCount;i++) { // mime type TCardinality mimeTypeSize; aStream >> mimeTypeSize; HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize); QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length()); CleanupStack::PopAndDestroy(mimeTypeBuf); // mime data TCardinality dataSize; aStream >> dataSize; QByteArray ba; ba.reserve(dataSize); aStream.ReadL(reinterpret_cast<uchar*>(ba.data_ptr()->data),dataSize); ba.data_ptr()->size = dataSize; qDebug() << "paste from clipboard mime: " << mimeType << " data: " << ba; aData->setData(mimeType,ba); } }
void CBTHidDevice::InternalizeL(RReadStream& aStream) { // Read the version number // Ignored in this version. aStream.ReadInt32L(); // Read all member variables from the stream // Leave if we get any error // Get a pointer to the address to fill TPtr8 addr = iAddress.Des(); // Read the address in aStream.ReadL(addr); iDeviceReleaseNumber = aStream.ReadUint32L(); iDeviceSubClass = aStream.ReadUint32L(); iCountryCode = aStream.ReadUint32L(); iVirtuallyCabled = aStream.ReadInt8L(); iReconnectInit = aStream.ReadInt8L(); iNormallyConnectable = aStream.ReadInt8L(); iProfileVersion = aStream.ReadUint32L(); iVendorID = aStream.ReadUint32L(); iProductID = aStream.ReadUint32L(); iUseSecurity = aStream.ReadInt8L(); aStream >> iDeviceName; aStream >> iDeviceClass; aStream >> *iDescList; }
// ----------------------------------------------------------------------------- // XIMPRBuf16Helper::InternalizeL() // ----------------------------------------------------------------------------- // EXPORT_C void XIMPRBuf16Helper::InternalizeL( RBuf16& aBuf, RReadStream& aStream ) { TInt length = aStream.ReadInt32L(); GrowIfNeededL( aBuf, length ); aStream.ReadL( aBuf, length ); }
// ---------------------------------------------------------------------------- // Helper internalize a descriptor array from a stream // ---------------------------------------------------------------------------- // EXPORT_C void MPXUser::InternalizeL( CDesCArray*& aArray, RReadStream& aStream) { delete aArray; aArray = NULL; TInt n=aStream.ReadInt32L(); if( n ) { CDesCArray* array=new(ELeave)CDesCArrayFlat(n); CleanupStack::PushL(array); TInt len; for (TInt i=0;i<n;++i) { len=aStream.ReadInt32L(); HBufC* item=HBufC::NewLC(len); TPtr bp = item->Des(); aStream.ReadL(bp,len); array->AppendL(*item); CleanupStack::PopAndDestroy(item); } CleanupStack::Pop(array); aArray = array; } else { // Dummy aArray = new(ELeave)CDesCArrayFlat(1); } }
EXPORT_C void CPromptData::InternalizeL(RReadStream& aStream) /** Internalizes the prompt data from the specified stream/ @param aStream The read stream */ { Reset(); iClientName.CreateL(aStream, KMaskDesLength16); iVendorName.CreateL(aStream, KMaskDesLength16); aStream >> iClientSid.iId; aStream >> iServerSid.iId; aStream >> iServiceId.iUid; iDestination.CreateL(aStream, KMaskDesLength16); iOpaqueData.CreateL(aStream, KMaskDesLength8); TInt32 count = aStream.ReadUint32L(); for (TInt i = 0; i < count; ++i) { TInt32 l = aStream.ReadInt32L(); HBufC* d = HBufC::NewMaxLC(l); TPtr wptr = d->Des(); aStream.ReadL(wptr, l); iDescriptions.AppendL(d); CleanupStack::Pop(d); } aStream >> iOptions; aStream >> iFlags; }
/** Opens the exported file and compares it with expected vCard file passed as argument. */ void CCntPBAPSupport::CompareFilesL(RReadStream& aCompareStream) { RFile exportedFile; TInt err = exportedFile.Open(iFsSession, KTempExportFile(), EFileRead); if (err != KErrNone) { ReportFileErrorL(err, KTempExportFile()); } CleanupClosePushL(exportedFile); RFileReadStream stream1(exportedFile); CleanupClosePushL(stream1); TBuf8<0x80> bufO,bufC; TInt line = 1; do { TRAP(err, stream1.ReadL(bufO, TChar(0xa))); if (err == KErrNone || err == KErrEof) { TRAP(err, aCompareStream.ReadL(bufC, TChar(0xa))); } if (err != KErrNone && err != KErrEof) { User::Leave(err); } test(CompareLines(bufO, bufC)); ++line; } while (err != KErrEof); CleanupStack::PopAndDestroy(2,&exportedFile); }
/** implementation of inherited internalization function */ void CLbsTransmitLocationLogEvent::DoInternalizeL(RReadStream& aReadStream) { iX3PApp = TUid::Uid(aReadStream.ReadInt32L()); TInt32 len = aReadStream.ReadInt32L(); aReadStream.ReadL(iDestination, len); ReadPosInfo(aReadStream, iPosInfo); }
// ----------------------------------------------------------------------------- // CDRMEventAddRemove::Internalize // Reads the data of the object from the given stream // (other items were commented in a header). // ----------------------------------------------------------------------------- // EXPORT_C void CDRMEventAddRemove::InternalizeL( RReadStream& aInput) { TInt inputLength = 0; MDRMEvent::InternalizeL(aInput); // Read the length of the HBufC8* inputLength = aInput.ReadInt32L(); // Reserve the HBufC8* if( !iContentID ) { iContentID = HBufC8::NewL(inputLength); } else { iContentID->ReAllocL(inputLength); } TPtr8 inRead(iContentID->Des()); // Read the HBufC8* aInput.ReadL(inRead, inputLength); // this implementation may need to be changed if the size of the enum changes iStatus = static_cast<TAddRemoveEventStatus>(aInput.ReadInt8L()); };
EXPORT_C void CLogEvent::SetDataL(RReadStream& aStream, TInt aLen) /** Sets event specific data from the specified stream. The data can be used for any purpose. The data is copied into a heap descriptor allocated by this function; the amount of data is only limited by the available memory. @param aStream The stream containing the event specific data. @param aLen The length of data to be read from the stream. */ { HBufC8* buf = NULL; if (aLen > 0) { buf = HBufC8::NewLC(aLen); buf->Des().SetLength(aLen); TPtr8 ptr(buf->Des()); aStream.ReadL(ptr, aLen); CleanupStack::Pop(); // buf } delete iData; iData = buf; }
// --------------------------------------------------------- // CSmlAlertInfo::InternalizeL(RReadStream& aStream) // Reads alert info from given stream // --------------------------------------------------------- EXPORT_C void CSmlAlertInfo::InternalizeL(RReadStream& aStream) { iErrorCode = aStream.ReadInt32L(); iJobControl = (CSmlAlertInfo::TJobControl) aStream.ReadInt32L(); iProtocol = (TSmlUsageType) aStream.ReadInt32L(); iSessionId = aStream.ReadInt32L(); iProfile = aStream.ReadInt32L(); iTransport = aStream.ReadInt32L(); TInt vendorLength = aStream.ReadInt32L(); iVendorSpecificInfo = HBufC8::NewL(vendorLength); TPtr8 ptrVendor = iVendorSpecificInfo->Des(); aStream.ReadL( ptrVendor, vendorLength ); TInt count = aStream.ReadInt32L(); for (TInt i = 0; i < count; i++) { TInt id = aStream.ReadInt32L(); iTaskIds.AppendL(id); TSmlSyncType syncType = ( TSmlSyncType )aStream.ReadInt32L(); iTaskSyncTypes.AppendL( syncType ); } }
// ----------------------------------------------------------------------------- // CDRMConstraint::ReadInt64L // ----------------------------------------------------------------------------- // void CDRMConstraint::ReadInt64L( TInt64& aRead, RReadStream& aStream ) { TPtr8 input(NULL,0,0); input.Set( reinterpret_cast<TUint8*>(&aRead), 0, sizeof(TInt64) ); aStream.ReadL( input, sizeof(TInt64) ); };
/** @SYMTestCaseID SYSLIB-STORE-CT-1195 @SYMTestCaseDesc Copying from one stream to another stream test @SYMTestPriority High @SYMTestActions Attempt for copying two streams @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void testCopyL(RWriteStream& aWriteStream,RReadStream& aReadStream) { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1195 Copying ")); for (TInt i=KTestLength;i>=0;--i) { aWriteStream.WriteL(aReadStream,i); aReadStream.ReadL(aWriteStream,KTestLength-i); } }
// // Test copying from one stream to another. // // // LOCAL_C void testCopyL(RWriteStream& aWriteStream,RReadStream& aReadStream) { test.Next(_L("Copying")); for (TInt i=KTestLength;i>=0;--i) { aWriteStream.WriteL(aReadStream,i); aReadStream.ReadL(aWriteStream,KTestLength-i); } }
TInt CLogPlayerManager::ReadNumberL(RReadStream& aReadStream, TChar aSeparator) { TBuf8<KLogPlayerMaxIdLength> id; aReadStream.ReadL(id, aSeparator); TLex8 lexer(id); TInt idVal; lexer.Val(idVal); return idVal; }
// --------------------------------------------------------------------------- // CCaInnerIconDescription::InternalizeL // --------------------------------------------------------------------------- // void CCaInnerIconDescription::InternalizeL( RReadStream& aStream ) { iId = aStream.ReadInt32L(); TUint length = aStream.ReadUint32L(); iFileName.Close(); iFileName.CreateL( length ); aStream.ReadL( iFileName, length ); length = aStream.ReadUint32L(); iSkinId.Close(); iSkinId.CreateL( length ); aStream.ReadL( iSkinId, length ); length = aStream.ReadUint32L(); iApplicationId.Close(); iApplicationId.CreateL( length ); aStream.ReadL( iApplicationId, length ); }
void CTestContextData::InternalizeL( RReadStream& aStream ) { TInt len = 0; len = aStream.ReadInt16L(); HBufC* buf = HBufC::NewLC( len ); TPtr bufPtr( buf->Des() ); aStream.ReadL( bufPtr, len ); delete iKey; iKey = buf; CleanupStack::Pop( buf ); buf = NULL; len = aStream.ReadInt16L(); buf = HBufC::NewLC( len ); bufPtr.Set( buf->Des() ); aStream.ReadL( bufPtr, len ); delete iValue; iValue = buf; CleanupStack::Pop( buf ); }
EXPORT_C void CBitset::InternalizeL(RReadStream& aStream) { // Delete the array delete [] iBitSet; iBitSet = NULL; // safety // Call the constructor with the max-Id value ConstructL(aStream.ReadInt32L()); // Create a descriptor to encapsulate the set TPtr8 ptr(iBitSet, 0, iWidth); // Load into the descriptor aStream.ReadL(ptr); }
// ----------------------------------------------------------------------------- // CDRMXOma::InternalizeL // ----------------------------------------------------------------------------- // void CDRMXOma::InternalizeL( RReadStream& aStream ) { TInt64 timeData = 0; TInt dataLength = 0; HBufC8* dataPart = 0; TPtr8 dataBuffer(NULL,0,0); TPtr16 dataBuffer2(NULL,0,0); // Read the ContentID dataLength = aStream.ReadInt32L(); if( dataLength ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); // Set the read buffer: dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); // Read the data: aStream.ReadL( dataBuffer ); // Pop the buffer CleanupStack::Pop(); // dataPart // If an old content identifier exists delete it if( iContentID ) { delete iContentID; iContentID = NULL; } // assign the new content id iContentID = dataPart; } else { // If an old content identifier exists delete it if( iContentID ) { delete iContentID; iContentID = NULL; } } // The Time stamp ReadInt64L( timeData, aStream ); iTimeStamp = timeData; // The time interval iWaitTime = aStream.ReadInt32L(); };
// ----------------------------------------------------------------------------- // CSIPMessage::ReadFromStreamL // ----------------------------------------------------------------------------- // RStringF CSIPMessage::ReadFromStreamL (RReadStream& aReadStream) const { TUint32 bufLength = aReadStream.ReadUint32L(); HBufC8* buf = HBufC8::NewLC (bufLength); TPtr8 bufPtr(buf->Des()); if (bufLength > 0) { aReadStream.ReadL (bufPtr,bufLength); } RStringF str = SIPStrings::Pool().OpenFStringL(bufPtr); CleanupStack::PopAndDestroy(buf); return str; }
TInt64 CLogPlayerManager::ReadTimeStampL(RReadStream& aReadStream) { TBuf8<KLogPlayerMaxTimeStampLength> timeStamp; aReadStream.ReadL(timeStamp, KLogPlayerFieldSeparator); TLex8 lexer(timeStamp); TInt64 timeVal; TInt err = lexer.Val(timeVal); if (err != KErrNone) { User::Leave(KErrNotSupported); } return timeVal; }
// --------------------------------------------------------------------------- // ?description_if_needed // --------------------------------------------------------------------------- // EXPORT_C void CXIMPTestFileSrvMsg::InternalizeL( RReadStream& aStream ) { iSrvMsgId = aStream.ReadUint32L(); TInt len = aStream.ReadUint32L(); HBufC8* buffer = HBufC8::NewLC( len ); TPtr8 ptr = buffer->Des(); aStream.ReadL( ptr, len ); delete iPayload; CleanupStack::Pop( buffer ); iPayload = buffer; }