javacommons/jvms/nativeportlayer/inc.s60/javafile.h
changeset 21 2a9601315dfc
child 80 d6dafc5d983f
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CJavaFile
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef JAVAFILE_H
       
    19 #define JAVAFILE_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <f32file.h>
       
    23 #include <string>
       
    24 
       
    25 #include <caf/caf.h>
       
    26 #include <caf/content.h>
       
    27 #include <caf/data.h>
       
    28 
       
    29 #include "javaosheaders.h"
       
    30 
       
    31 namespace javaruntime
       
    32 {
       
    33 
       
    34 class MJavaFile;
       
    35 
       
    36 OS_NONSHARABLE_CLASS(CJavaFile): public CBase, public MJavaFile
       
    37 {
       
    38 
       
    39 public:
       
    40     static MJavaFile* NewL();
       
    41 
       
    42     virtual ~CJavaFile();
       
    43 
       
    44     virtual TInt Open(RFs& aFs,const TDesC& aFileName, TUint aFileMode);
       
    45     virtual void Close();
       
    46     virtual TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
       
    47     virtual TInt Read(TDes8& aDes) const;
       
    48     virtual TInt Read(TDes8& aDes,TInt aLength) const;
       
    49     virtual TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
       
    50     virtual TInt Write(const TDesC8& aDes);
       
    51     virtual TInt Write(const TDesC8& aDes,TInt aLength);
       
    52     virtual TInt Write(TInt aPos,const TDesC8& aDes);
       
    53     virtual TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength);
       
    54     virtual TInt Lock(TInt aPos,TInt aLength) const;
       
    55     virtual TInt UnLock(TInt aPos,TInt aLength) const;
       
    56     virtual TInt Seek(TSeek aMode,TInt& aPos) const;
       
    57     virtual TInt Flush();
       
    58     virtual TInt Size(TInt& aSize) const;
       
    59     virtual TInt SetSize(TInt aSize);
       
    60 
       
    61 protected:
       
    62     CJavaFile();
       
    63 
       
    64 private:
       
    65     enum TJavaFileMode
       
    66     {
       
    67         EJavaFileClosed,
       
    68         EJavaFileOpenForCaf,
       
    69         EJavaFileOpenForNormalFile
       
    70     };
       
    71     TBool isDrmFile(const TDesC& aFileName);
       
    72 
       
    73 private:
       
    74     void ConstructL();
       
    75     void OpenCafL(const TDesC& aFileName);
       
    76 
       
    77 private:
       
    78     ContentAccess::CContent*    iCafContent; //Owns
       
    79     ContentAccess::CData*       iCafData; //Owns
       
    80     TJavaFileMode               iJavaFileMode;
       
    81     RFile                       iNormalFile;
       
    82     std::wstring                mFileName;
       
    83 };
       
    84 
       
    85 } // end of namespace javaruntime
       
    86 
       
    87 IMPORT_C void Dummy1(); //These are keeping the ordinals in J9 understandable order. TODO remove these at some point
       
    88 IMPORT_C void Dummy2();
       
    89 IMPORT_C void Dummy3();
       
    90 IMPORT_C void Dummy4();
       
    91 IMPORT_C void Dummy5();
       
    92 IMPORT_C void Dummy6();
       
    93 IMPORT_C void Dummy7();
       
    94 IMPORT_C void Dummy8();
       
    95 IMPORT_C void Dummy9();
       
    96 #endif // JAVAFILE_H
       
    97