1 /*
2  * Copyright (c) 2022-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef HISTREAMER_FOUNDATION_OSAL_FILESYSTEM_FILE_SYSTEM_H
16 #define HISTREAMER_FOUNDATION_OSAL_FILESYSTEM_FILE_SYSTEM_H
17 
18 #include <cstdint>
19 #include <iosfwd>
20 #include <sys/stat.h>
21 
22 namespace OHOS {
23 namespace Media {
24 namespace OSAL {
25 class FileSystem {
26 public:
27     static bool IsRegularFile(const std::string& path);
28     static bool IsFdValid(int32_t fd, struct stat& s);
29     static bool IsRegularFile(int32_t fd);
30     static bool IsSocketFile(int32_t fd);
31     static bool IsSeekable(int32_t fd);
32     static bool IsDirectory(const std::string& path);
33     static bool IsExists(const std::string& path);
34     static bool MakeDir(const std::string& path);
35     static bool MakeMultipleDir(const std::string& path);
36     static void RemoveFilesInDir(const std::string& path);
37     static void ClearFileContent(const std::string& fullPath);
38     static std::string GetTmpFileName();
39 };
40 } // namespace OSAL
41 } // namespace Media
42 } // namespace OHOS
43 #endif // HISTREAMER_FOUNDATION_OSAL_FILESYSTEM_FILE_SYSTEM_H
44