85 * @return base64 encoded string. |
85 * @return base64 encoded string. |
86 */ |
86 */ |
87 OS_IMPORT static std::string base64encode(const std::string& aData); |
87 OS_IMPORT static std::string base64encode(const std::string& aData); |
88 |
88 |
89 /** |
89 /** |
|
90 * Encode wstring to base64 wstring byte by byte. |
|
91 * |
|
92 * wstring aData is base64 encoded as a byte array. |
|
93 * If the wstring has been created from TDesC16 in Symbian it contains |
|
94 * UTF-16LE (UCS-2) encoded 16-bit characters. |
|
95 * The result is byte array that contains 8-bit ASCII characters. |
|
96 * Each of these 8-bit character is converted to the corresponding |
|
97 * wchar and appended to the result wstring. |
|
98 * |
|
99 * @see \sf\app\jrt\javamanager\javainstaller\installer\javasrc\com\nokia |
|
100 * \mj\impl\installer\utils\Args.java, decodeBase64Args() |
|
101 * @param aData wstring containing the data to be encoded. |
|
102 * @return base64 encoded result wstring. |
|
103 */ |
|
104 OS_IMPORT static std::wstring wbase64encode(const std::wstring& aData); |
|
105 |
|
106 /** |
90 * Decode base64 string. |
107 * Decode base64 string. |
91 * |
108 * |
92 * @param aData base64 encoded string. |
109 * @param aData base64 encoded string. |
93 * @return decoded string. |
110 * @return decoded string. |
94 */ |
111 */ |
103 * @return UTF-16 wstring, for example "ÄÄNESTÄ.EXE" |
120 * @return UTF-16 wstring, for example "ÄÄNESTÄ.EXE" |
104 * @throws ExceptionBase if UTF-8 to UTF-16 conversion fails |
121 * @throws ExceptionBase if UTF-8 to UTF-16 conversion fails |
105 */ |
122 */ |
106 OS_IMPORT static std::wstring percentDecode(const std::wstring& str); |
123 OS_IMPORT static std::wstring percentDecode(const std::wstring& str); |
107 |
124 |
|
125 /** |
|
126 * This function checks whether is it called during the first device boot |
|
127 * and stores the information to static data so that isFirstBoot() can |
|
128 * return it. |
|
129 * |
|
130 * Call this function always when the process is starting. |
|
131 * |
|
132 * This function creates a flag file to the private data cage / work directory |
|
133 * of the process. |
|
134 * |
|
135 * In Symbian this method can be called only from Java Installer or |
|
136 * Java MIDP processes. |
|
137 * |
|
138 * Return 0 if check was made successfully. Otherwise it returns errno |
|
139 * defined in STDLIBS errno.h |
|
140 */ |
|
141 OS_IMPORT static int initIsFirstBoot(); |
|
142 |
|
143 /** |
|
144 * This function returns true if it called during the first boot. |
|
145 * Otherwise it returns false. |
|
146 * |
|
147 * initIsFirstBoot() must be called before this function can be called. |
|
148 */ |
|
149 OS_IMPORT static bool isFirstBoot(); |
|
150 |
|
151 |
108 public: |
152 public: |
109 /** |
153 /** |
110 * Decodes one %<X><Y> sequence. |
154 * Decodes one %<X><Y> sequence. |
111 * @param first the character <X> |
155 * @param first the character <X> |
112 * @param sec the character <Y> |
156 * @param sec the character <Y> |
113 * @return decoded char value 0-255 |
157 * @return decoded char value 0-255 |
114 * @throws ExceptionBase if <X> and <Y> are not hexadecimal characters |
158 * @throws ExceptionBase if <X> and <Y> are not hexadecimal characters |
115 */ |
159 */ |
116 static char decodeOnePercentSeq(wchar_t first, wchar_t sec); |
160 static char decodeOnePercentSeq(wchar_t first, wchar_t sec); |
|
161 |
|
162 private: |
|
163 static bool mFirstBoot; |
|
164 |
117 }; |
165 }; |
118 |
166 |
119 // A simple class for storing char array that is deleted automatically |
167 // A simple class for storing char array that is deleted automatically |
120 // when going out of scope. |
168 // when going out of scope. |
121 class ScopedCharArray |
169 class ScopedCharArray |