ReadWriteUtils.h revision 27ed8ad2db653f6ac07dcf8bcc05e2409c8bb024
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef __READ_WRITE_UTILS_H__ 18#define __READ_WRITE_UTILS_H__ 19 20#include <utils/FileMap.h> 21#include <drm/drm_framework_common.h> 22 23namespace android { 24 25/** 26 * This is an utility class which performs IO operations. 27 * 28 */ 29class ReadWriteUtils { 30public: 31 /** 32 * Constructor for ReadWriteUtils 33 */ 34 ReadWriteUtils() {} 35 36 /** 37 * Destructor for ReadWriteUtils 38 */ 39 virtual ~ReadWriteUtils(); 40 41public: 42 /** 43 * Reads the data from the file path provided 44 * 45 * @param[in] filePath Path of the file 46 * @return Data read from the file 47 */ 48 static String8 readBytes(const String8& filePath); 49 /** 50 * Writes the data into the file path provided 51 * 52 * @param[in] filePath Path of the file 53 * @param[in] dataBuffer Data to write 54 */ 55 static void writeToFile(const String8& filePath, const String8& data); 56 /** 57 * Appends the data into the file path provided 58 * 59 * @param[in] filePath Path of the file 60 * @param[in] dataBuffer Data to append 61 */ 62 static void appendToFile(const String8& filePath, const String8& data); 63 64private: 65 FileMap* mFileMap; 66}; 67 68}; 69 70#endif /* __READ_WRITE_UTILS_H__ */ 71 72