persistentstorage/store/USTRM/US_STRM.CPP
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "US_STD.H"
       
    17 
       
    18 EXPORT_C void RReadStream::Release()
       
    19 /** Frees resources before abandoning the stream.
       
    20 
       
    21 Note that, if a cleanup item for the stream was placed on the cleanup stack 
       
    22 when the stream was opened by a call to OpenLC(), then this function need 
       
    23 not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy(). */
       
    24 	{
       
    25 	if (iSrc==NULL)
       
    26 		return;
       
    27 //
       
    28 	iSrc->Release();
       
    29 	iSrc=NULL;
       
    30 	}
       
    31 
       
    32 EXPORT_C void RReadStream::PushL()
       
    33 /** Puts a cleanup item for this read stream object onto the cleanup stack. This 
       
    34 allows allocated resources to be cleaned up if a subsequent leave occurs. */
       
    35 	{
       
    36 	CleanupReleasePushL(*this);
       
    37 	}
       
    38 
       
    39 EXPORT_C void RReadStream::ReadL(TDes8& aDes)
       
    40 /** Reads sufficient data from this stream to fill the specified 8 bit descriptor up to its maximum length.
       
    41 No other information is read from this read stream.
       
    42 
       
    43 @param aDes A reference to a modifiable descriptor which is to receive the data read from this stream. Passing the build 
       
    44 independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.*/
       
    45 	{
       
    46 	ReadL(aDes,aDes.MaxLength());
       
    47 	}
       
    48 
       
    49 EXPORT_C void RReadStream::ReadL(TDes8& aDes,TInt aLength)
       
    50 /** Reads data of specified length from this stream into the specified 8 bit descriptor. No other information is read 
       
    51 from this stream.
       
    52 
       
    53 @param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. 
       
    54 Passing the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit 
       
    55 or the 16 bit) at build time.
       
    56 @param aLength The length of data to be read from this stream. This value must be non-negative and must not be greater than the maximum length of the descriptor otherwise the function raises a USER 11 panic.*/
       
    57 	{
       
    58 	__ASSERT_DEBUG(aLength<=aDes.MaxLength(),Panic(EStreamReadBeyondEnd));
       
    59 	aDes.SetLength(aLength);
       
    60 	ReadL((TUint8*)aDes.Ptr(),aLength);
       
    61 	}
       
    62 
       
    63 EXPORT_C void RReadStream::ReadL(TDes8& aDes,TChar aDelim)
       
    64 /** Reads data from this stream into the 8 bit descriptor, until either the specified delimiter is encountered or the descriptor is filled to its maximum length.
       
    65 The resulting data in aDes always includes the delimiter aDelim, if aDes is large enough.
       
    66 
       
    67 @param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing 
       
    68 the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.
       
    69 @param aDelim The delimiter marking the end of the data in the stream.*/
       
    70 
       
    71 	{
       
    72 	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
       
    73 	TUint8* ptr=(TUint8*)aDes.Ptr();
       
    74 	TDelimitedInput8 input(ptr,aDes.MaxLength(),aDelim);
       
    75 	do
       
    76 		{
       
    77 		iSrc->ReadL(input);
       
    78 		} while (!input.Done());
       
    79 	aDes.SetLength(input.Ptr()-ptr);
       
    80 	}
       
    81 
       
    82 EXPORT_C void RReadStream::ReadL(TUint8* aPtr,TInt aLength)
       
    83 /** Reads data of specified length from this stream into the location defined by the specified TUint8 pointer.
       
    84 
       
    85 @param aPtr The target location for the streamed in data.
       
    86 @param aLength The length of data to be streamed in.*/
       
    87 	{
       
    88 	__ASSERT_DEBUG(aLength>=0,Panic(EStreamReadLengthNegative));
       
    89 	if (aLength==0)
       
    90 		return;
       
    91 //
       
    92 	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
       
    93 	TInt len=iSrc->ReadL(aPtr,aLength);
       
    94 	__ASSERT_DEBUG(len>=0&&len<=aLength,Panic(EStreamReadInBreach));
       
    95 	if (len<aLength)
       
    96 		__LEAVE(KErrEof);
       
    97 	}
       
    98 
       
    99 EXPORT_C void RReadStream::ReadL(TInt aLength)
       
   100 /** Discards data of specified length read from this stream.
       
   101 
       
   102 @param aLength The length of data to be discarded from this read stream.*/
       
   103 	{
       
   104 	__ASSERT_DEBUG(aLength>=0,Panic(EStreamReadLengthNegative));
       
   105 	if (aLength==0)
       
   106 		return;
       
   107 //
       
   108 	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
       
   109 	TNullInput input;
       
   110 	TInt len=iSrc->ReadL(input,aLength);
       
   111 	__ASSERT_DEBUG(len>=0&&len<=aLength,Panic(EStreamReadInBreach));
       
   112 	if (len<aLength)
       
   113 		__LEAVE(KErrEof);
       
   114 	}
       
   115 
       
   116 EXPORT_C void RReadStream::ReadL(TDes16& aDes)
       
   117 /** Reads sufficient data from this stream to fill the specified 16 bit descriptor up to its maximum length. 
       
   118 No other information is read from this read stream.
       
   119 
       
   120 @param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing 
       
   121 the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 
       
   122 bit) at build time.*/
       
   123 	{
       
   124 	ReadL(aDes,aDes.MaxLength());
       
   125 	}
       
   126 
       
   127 EXPORT_C void RReadStream::ReadL(TDes16& aDes,TInt aLength)
       
   128 /** Reads data of specified length from this stream into the specified 16 bit descriptor. No other information is read from this stream.
       
   129 
       
   130 @param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing the 
       
   131 build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) 
       
   132 at build time.
       
   133 @param aLength The length of data to be read from this stream. This value must be non-negative and must not be greater
       
   134 than the maximum length of the descriptor otherwise the function raises a USER 11 panic.*/
       
   135 	{
       
   136 	__ASSERT_DEBUG(aLength<=aDes.MaxLength(),Panic(EStreamReadBeyondEnd));
       
   137 	aDes.SetLength(aLength);
       
   138 	ReadL((TUint16*)aDes.Ptr(),aLength);
       
   139 	}
       
   140 
       
   141 EXPORT_C void RReadStream::ReadL(TDes16& aDes,TChar aDelim)
       
   142 /** Reads data from this stream into the 16 bit descriptor, until either the specified delimiter is encountered or 
       
   143 the descriptor is filled to its maximum length.
       
   144 The resulting data in aDes always includes the delimiter aDelim, if aDes is large enough.
       
   145 
       
   146 @param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing 
       
   147 the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.
       
   148 @param aDelim The delimiter marking the end of the data in the stream.*/
       
   149 	{
       
   150 	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
       
   151 	TUint16* ptr=(TUint16*)aDes.Ptr();
       
   152 	TDelimitedInput16 input(ptr,aDes.MaxLength(),aDelim);
       
   153 	do
       
   154 		{
       
   155 		iSrc->ReadL(input);
       
   156 		} while (!input.Done());
       
   157 	aDes.SetLength(input.Ptr()-ptr);
       
   158 	}
       
   159 
       
   160 EXPORT_C void RReadStream::ReadL(TUint16* aPtr,TInt aLength)
       
   161 /** Reads data of specified length from this stream into the specified 16 bit descriptor.
       
   162  No other information is read from this stream.
       
   163 
       
   164 @param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.
       
   165 @param aLength The length of data to be read from this stream. This value must be non-negative and must not be greater than the maximum length of the descriptor otherwise the function raises a USER 11 panic.*/
       
   166 	{
       
   167 	__ASSERT_DEBUG(aLength>=0,Panic(EStreamReadLengthNegative));
       
   168 	ReadL((TUint8*)aPtr,aLength<<1); // platform dependency
       
   169 	}
       
   170 
       
   171 EXPORT_C TInt8 RReadStream::ReadInt8L()
       
   172 /** Internalises a TInt8 value The function reads an 8 bit value from this stream 
       
   173 and interprets it as a TInt8.
       
   174 
       
   175 @return The 8 bit value read from this stream. */
       
   176 	{
       
   177 	TInt8 val;
       
   178 	ReadL((TUint8*)&val,1); // platform dependency
       
   179 	return val;
       
   180 	}
       
   181 
       
   182 EXPORT_C TInt16 RReadStream::ReadInt16L()
       
   183 /** Internalises a TInt16 value. The function reads a 16 bit value from this stream 
       
   184 and interprets it as a TInt16.
       
   185 
       
   186 @return The 16 bit value read from this stream. */
       
   187 	{
       
   188 	TInt16 val;
       
   189 	ReadL((TUint8*)&val,2); // platform dependency
       
   190 	return val;
       
   191 	}
       
   192 
       
   193 EXPORT_C TInt32 RReadStream::ReadInt32L()
       
   194 /** Internalises a TInt32 value. The function reads a 32 bit value from this stream 
       
   195 and interprets it as a TInt32.
       
   196 
       
   197 @return The 32 bit value read from this stream. */
       
   198 	{
       
   199 	TInt32 val;
       
   200 	ReadL((TUint8*)&val,4); // platform dependency
       
   201 	return val;
       
   202 	}
       
   203 
       
   204 EXPORT_C TUint8 RReadStream::ReadUint8L()
       
   205 /** Internalises a TUint8 value. The function reads an 8 bit value from this stream 
       
   206 and interprets it as a TUint8.
       
   207 
       
   208 @return The 8 bit value read from this stream. */
       
   209 	{
       
   210 	TUint8 val;
       
   211 	ReadL(&val,1);
       
   212 	return val;
       
   213 	}
       
   214 
       
   215 EXPORT_C TUint16 RReadStream::ReadUint16L()
       
   216 /** Internalises a TUint16 value. The function reads a 16 bit value from this 
       
   217 stream and interprets it as a TUint16.
       
   218 
       
   219 @return The 16 bit value read from this stream. */
       
   220 	{
       
   221 	TUint16 val;
       
   222 	ReadL((TUint8*)&val,2); // platform dependency
       
   223 	return val;
       
   224 	}
       
   225 
       
   226 EXPORT_C TUint32 RReadStream::ReadUint32L()
       
   227 /** Internalises a TUint32 value. The function reads a 32 bit value from this 
       
   228 stream and interprets it as a TUint32.
       
   229 
       
   230 @return The 32 bit value read from this stream. */
       
   231 	{
       
   232 	TUint32 val;
       
   233 	ReadL((TUint8*)&val,4); // platform dependency
       
   234 	return val;
       
   235 	}
       
   236 
       
   237 EXPORT_C TReal32 RReadStream::ReadReal32L() __SOFTFP
       
   238 /** Internalises a TReal32 value. The function reads a 32 bit value from this 
       
   239 stream and interprets it as a TReal32.
       
   240 
       
   241 @return The 32 bit value read from this read stream. */
       
   242 	{
       
   243 	TReal32 val;
       
   244 	ReadL((TUint8*)&val,4); // platform dependency
       
   245 	return val;
       
   246 	}
       
   247 
       
   248 EXPORT_C TReal64 RReadStream::ReadReal64L() __SOFTFP
       
   249 /** Internalises a TReal64 value. The function reads a 64 bit value from this 
       
   250 stream and interprets it as a TReal64.
       
   251 
       
   252 @return The 64 bit value read from this stream. */
       
   253 	{
       
   254 #if defined(__DOUBLE_WORDS_SWAPPED__)
       
   255 	union {TReal64 val;TUint32 buf[3];} u; // platform dependency
       
   256 	ReadL((TUint8*)&u.buf[1],8);
       
   257 	u.buf[0]=u.buf[2];
       
   258 	return u.val;
       
   259 #else
       
   260 	TReal64 val;
       
   261 	ReadL((TUint8*)&val,8); // platform dependency
       
   262 	return val;
       
   263 #endif
       
   264 	}
       
   265 
       
   266 EXPORT_C void RWriteStream::Close()
       
   267 /** Commits data to the stream before freeing resources used by the stream. This 
       
   268 ensures that any buffered data is written to the stream.
       
   269 
       
   270 Note that the function cannot leave. Any errors arising from the attempt to 
       
   271 commit data to the stream are ignored. */
       
   272 	{
       
   273 	if (iSnk==NULL)
       
   274 		return;
       
   275 //
       
   276 	iSnk->Close();
       
   277 	iSnk=NULL;
       
   278 	}
       
   279 
       
   280 EXPORT_C void RWriteStream::Release()
       
   281 /** Frees resources before abandoning the stream. The function is called after 
       
   282 data has been committed to the stream.
       
   283 
       
   284 Note that if a cleanup item for the stream was placed on the cleanup stack 
       
   285 when the stream was opened (e.g by a call to RStoreWriteStreamss CreateLC(), 
       
   286 OpenLC(), ReplaceLC() or RDictionaryStores AssignLC() etc), then this function 
       
   287 need not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy(). */
       
   288 	{
       
   289 	if (iSnk==NULL)
       
   290 		return;
       
   291 //
       
   292 	iSnk->Release();
       
   293 	iSnk=NULL;
       
   294 	}
       
   295 
       
   296 EXPORT_C void RWriteStream::CommitL()
       
   297 /** Ensures that any buffered data is written to the stream. Once committed, it 
       
   298 is not possible to roll back the newly written data. */
       
   299 	{
       
   300 	if (iSnk==NULL)
       
   301 		return;
       
   302 //
       
   303 	iSnk->SynchL();
       
   304 	}
       
   305 
       
   306 EXPORT_C void RWriteStream::PushL()
       
   307 /** Puts a cleanup item for this write stream object onto the cleanup stack. This 
       
   308 allows allocated resources to be cleaned up if a subsequent leave occurs. */
       
   309 	{
       
   310 	CleanupReleasePushL(*this);
       
   311 	}
       
   312 
       
   313 EXPORT_C void RWriteStream::WriteL(const TDesC8& aDes)
       
   314 /** Writes the content of the 8 bit descriptor to the stream. No other information 
       
   315 is written to this write stream.
       
   316 
       
   317 @param aDes A reference to a descriptor. Passing the build independent type 
       
   318 TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
       
   319 the 8 bit or the 16 bit) at build time. */
       
   320 	{
       
   321 	WriteL(aDes.Ptr(),aDes.Length());
       
   322 	}
       
   323 
       
   324 EXPORT_C void RWriteStream::WriteL(const TDesC8& aDes,TInt aLength)
       
   325 /** Writes data of the specified length from the 8 bit descriptor to the stream. 
       
   326 No other information is written to this write stream.
       
   327 
       
   328 @param aDes A reference to a descriptor. Passing the build independent type 
       
   329 TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
       
   330 the 8 bit or the 16 bit) at build time.
       
   331 @param aLength The length of data to be written to this stream. */
       
   332 
       
   333 	{
       
   334 	__ASSERT_DEBUG(aLength<=aDes.Length(),Panic(EStreamWriteBeyondEnd));
       
   335 	WriteL(aDes.Ptr(),aLength);
       
   336 	}
       
   337 
       
   338 EXPORT_C void RWriteStream::WriteL(const TUint8* aPtr,TInt aLength)
       
   339 /** Writes 8 bit data of the specified length from the specified location to this 
       
   340 write stream.
       
   341 
       
   342 @param aPtr The location from where data is to be streamed out.
       
   343 @param aLength The length of data to be streamed out. */
       
   344 
       
   345 	{
       
   346 	__ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative));
       
   347 	if (aLength==0)
       
   348 		return;
       
   349 //
       
   350 	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
       
   351 	iSnk->WriteL(aPtr,aLength);
       
   352 	}
       
   353 
       
   354 EXPORT_C void RWriteStream::WriteL(RReadStream &aStream)
       
   355 /** Writes the content of the specified read stream to this write stream.
       
   356 
       
   357 @param aStream A reference to a read stream which is to be written to this 
       
   358 stream. */
       
   359 
       
   360 	{
       
   361 	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
       
   362 	TSourceOutput output(aStream.iSrc);
       
   363 	iSnk->WriteL(output);
       
   364 	}
       
   365 
       
   366 EXPORT_C void RWriteStream::WriteL(RReadStream& aStream,TInt aLength)
       
   367 /** Writes data of the specified length from the specified read stream to this 
       
   368 stream.
       
   369 
       
   370 @param aStream A reference to a read stream part of whose content is to be 
       
   371 written to this stream.
       
   372 @param aLength The length of data from the read stream to be written to this 
       
   373 write stream. */
       
   374 
       
   375 	{
       
   376 	__ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative));
       
   377 	if (aLength==0)
       
   378 		return;
       
   379 //
       
   380 	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
       
   381 	TSourceOutput output(aStream.iSrc);
       
   382 	TInt len=iSnk->WriteL(output,aLength);
       
   383 	__ASSERT_DEBUG(len>=0&&len<=aLength,Panic(EStreamReadInBreach));
       
   384 	if (len<aLength)
       
   385 		__LEAVE(KErrEof);
       
   386 	}
       
   387 
       
   388 EXPORT_C void RWriteStream::WriteL(const TDesC16& aDes)
       
   389 /** Writes the content of the 16 bit descriptor to the stream. No other information 
       
   390 is written to this write stream.
       
   391 
       
   392 @param aDes A reference to a descriptor. Passing the build independent type 
       
   393 TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
       
   394 the 8 bit or the 16 bit) at build time. */
       
   395 
       
   396 	{
       
   397 	WriteL(aDes.Ptr(),aDes.Length());
       
   398 	}
       
   399 
       
   400 EXPORT_C void RWriteStream::WriteL(const TDesC16& aDes,TInt aLength)
       
   401 /** Writes data of the specified length from the 16 bit descriptor to the stream. 
       
   402 No other information is written to this write stream.
       
   403 
       
   404 @param aDes A reference to a descriptor. Passing the build independent type 
       
   405 TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
       
   406 the 8 bit or the 16 bit) at build time.
       
   407 @param aLength The length of data to be written to this stream. */
       
   408 
       
   409 	{
       
   410 	__ASSERT_DEBUG(aLength<=aDes.Length(),Panic(EStreamWriteBeyondEnd));
       
   411 	WriteL(aDes.Ptr(),aLength);
       
   412 	}
       
   413 
       
   414 EXPORT_C void RWriteStream::WriteL(const TUint16* aPtr,TInt aLength)
       
   415 /** Writes 16 bit data of the specified length from the specified location to this 
       
   416 write stream.
       
   417 
       
   418 @param aPtr The location from where data is to be streamed out.
       
   419 @param aLength The length of data to be streamed out. */
       
   420 
       
   421 	{
       
   422 	__ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative));
       
   423 	WriteL((const TUint8*)aPtr,aLength<<1); // platform dependency
       
   424 	}
       
   425 
       
   426 EXPORT_C void RWriteStream::WriteInt8L(TInt aValue)
       
   427 /** Writes a TInt value as an 8 bit value to this stream.
       
   428 
       
   429 @param aValue The value to be written to this stream. */
       
   430 
       
   431 	{
       
   432 	WriteL((const TUint8*)&aValue,1); // platform dependency
       
   433 	}
       
   434 
       
   435 EXPORT_C void RWriteStream::WriteInt16L(TInt aValue)
       
   436 /** Writes a TInt value as a 16 bit value to this stream.
       
   437 
       
   438 @param aValue The value to be written to this stream. */
       
   439 	{
       
   440 	WriteL((const TUint8*)&aValue,2); // platform dependency
       
   441 	}
       
   442 
       
   443 EXPORT_C void RWriteStream::WriteInt32L(TInt32 aValue)
       
   444 /** Writes a TInt32 value as a 32 bit value to this stream.
       
   445 
       
   446 @param aValue The value to be written to this stream. */
       
   447 
       
   448 	{
       
   449 	WriteL((const TUint8*)&aValue,4); // platform dependency
       
   450 	}
       
   451 
       
   452 EXPORT_C void RWriteStream::WriteUint8L(TUint aValue)
       
   453 /** Writes a TUint value as an 8 bit value to this stream.
       
   454 
       
   455 @param aValue The value to be written to this stream. */
       
   456 	{
       
   457 	WriteL((const TUint8*)&aValue,1); // platform dependency
       
   458 	}
       
   459 
       
   460 EXPORT_C void RWriteStream::WriteUint16L(TUint aValue)
       
   461 /** Writes a TUint value as a 16 bit value to this stream.
       
   462 
       
   463 @param aValue The value to be written to this stream. */
       
   464 
       
   465 	{
       
   466 	WriteL((const TUint8*)&aValue,2); // platform dependency
       
   467 	}
       
   468 
       
   469 EXPORT_C void RWriteStream::WriteUint32L(TUint32 aValue)
       
   470 /** Writes a TUint32 value as a 32 bit value to this stream.
       
   471 
       
   472 @param aValue The value to be written to this stream. */
       
   473 	{
       
   474 	WriteL((const TUint8*)&aValue,4); // platform dependency
       
   475 	}
       
   476 
       
   477 EXPORT_C void RWriteStream::WriteReal32L(TReal aValue) __SOFTFP
       
   478 /** Writes a TReal value as a 32 bit value to this stream.
       
   479 
       
   480 @param aValue The value to be written to this stream. */
       
   481 
       
   482 	{
       
   483 	TReal32 val=TReal32(aValue);
       
   484 	WriteL((const TUint8*)&val,4); // platform dependency
       
   485 	}
       
   486 
       
   487 EXPORT_C void RWriteStream::WriteReal64L(TReal64 aValue) __SOFTFP
       
   488 /** Writes a TReal64 value as a 64 bit value to this stream.
       
   489 
       
   490 @param aValue The value to be written to this stream. */
       
   491 	{
       
   492 #if defined(__DOUBLE_WORDS_SWAPPED__)
       
   493 	union {TReal64 val;TUint32 buf[3];} u; // platform dependency
       
   494 	u.val=aValue;
       
   495 	u.buf[2]=u.buf[0];
       
   496 	WriteL((const TUint8*)&u.buf[1],8);
       
   497 #else
       
   498 	WriteL((const TUint8*)&aValue,8); // platform dependency
       
   499 #endif
       
   500 	}
       
   501 
       
   502 EXPORT_C void RWriteStream::WriteRefL(TStreamRef aRef)
       
   503 //
       
   504 // Interpret and write aRef to this stream.
       
   505 //
       
   506 	{
       
   507 	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
       
   508 	__ASSERT_DEBUG(iExterL!=NULL,Panic(EStreamDoesNotUnderstand));
       
   509 	(*iExterL)(aRef,*this);
       
   510 	}
       
   511