1 /* 2 * Copyright 2014 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 IMG_UTILS_FILE_OUTPUT_H 18 #define IMG_UTILS_FILE_OUTPUT_H 19 20 #include <img_utils/Output.h> 21 #include <cutils/compiler.h> 22 #include <utils/Errors.h> 23 #include <utils/String8.h> 24 #include <stdio.h> 25 #include <stdint.h> 26 27 namespace android { 28 namespace img_utils { 29 30 class ANDROID_API FileOutput : public Output { 31 public: 32 explicit FileOutput(String8 path); 33 virtual ~FileOutput(); 34 virtual status_t open(); 35 virtual status_t write(const uint8_t* buf, size_t offset, size_t count); 36 virtual status_t close(); 37 private: 38 FILE *mFp; 39 String8 mPath; 40 bool mOpen; 41 }; 42 43 } /*namespace img_utils*/ 44 } /*namespace android*/ 45 46 #endif /*IMG_UTILS_FILE_OUTPUT_H*/ 47