Home | History | Annotate | Download | only in common
      1 /*
      2  * Copyright (C) 2015 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 FILE_H_
     18 
     19 #define FILE_H_
     20 
     21 #include <media/stagefright/foundation/ABase.h>
     22 #include <utils/Errors.h>
     23 
     24 namespace android {
     25 
     26 struct File {
     27     File();
     28     File(const char *path, const char *mode);
     29 
     30     ~File();
     31 
     32     status_t initCheck() const;
     33     status_t setTo(const char *path, const char *mode);
     34     void close();
     35 
     36     ssize_t read(void *data, size_t size);
     37     ssize_t write(const void *data, size_t size);
     38 
     39     off64_t seekTo(off64_t pos, int whence = SEEK_SET);
     40 
     41 private:
     42     status_t mInitCheck;
     43     int mFd;
     44 
     45     DISALLOW_EVIL_CONSTRUCTORS(File);
     46 };
     47 
     48 }  // namespace android
     49 
     50 #endif  // FILE_H_
     51