equal
deleted
inserted
replaced
|
1 // Copyright (c) 2006-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 // Implementation of XOP serializer Output Stream |
|
15 // |
|
16 |
|
17 #include <bafl/sysutil.h> |
|
18 #include "xmlengxopfileoutputstream.h" |
|
19 |
|
20 TXmlEngSXOPFileOutputStream::TXmlEngSXOPFileOutputStream(RFile& aFile,RFs& aRFs) |
|
21 { |
|
22 TDriveInfo drInfo; |
|
23 iError = aFile.Drive(iDrive, drInfo); |
|
24 iFile = aFile; |
|
25 iRFs = aRFs; |
|
26 } |
|
27 |
|
28 TInt TXmlEngSXOPFileOutputStream::Write(const TDesC8 &aBuffer) |
|
29 { |
|
30 TRAP(iError,WriteL(aBuffer)); |
|
31 if(iError) |
|
32 { |
|
33 return -1; |
|
34 } |
|
35 return aBuffer.Size(); |
|
36 } |
|
37 |
|
38 TInt TXmlEngSXOPFileOutputStream::Close() |
|
39 { |
|
40 return KErrNone; |
|
41 } |
|
42 |
|
43 TInt TXmlEngSXOPFileOutputStream::CloseAll() |
|
44 { |
|
45 iFile.Close(); |
|
46 return KErrNone; |
|
47 } |
|
48 |
|
49 TInt TXmlEngSXOPFileOutputStream::CheckError() |
|
50 { |
|
51 return iError; |
|
52 } |
|
53 |
|
54 void TXmlEngSXOPFileOutputStream::WriteL(const TDesC8 &aBuffer) |
|
55 { |
|
56 if(SysUtil::DiskSpaceBelowCriticalLevelL(&iRFs, aBuffer.Size(), iDrive)) |
|
57 { |
|
58 User::Leave(KErrDiskFull); |
|
59 } |
|
60 User::LeaveIfError(iFile.Write(aBuffer)); |
|
61 } |