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 class FileSystem {
25 public:
26     static bool IsRegularFile(const std::string& path);
27     static bool IsFdValid(int32_t fd, struct stat& s);
28     static bool IsRegularFile(int32_t fd);
29     static bool IsSocketFile(int32_t fd);
30     static bool IsSeekable(int32_t fd);
31     static bool IsDirectory(const std::string& path);
32     static bool IsExists(const std::string& path);
33     static bool MakeDir(const std::string& path);
34     static bool MakeMultipleDir(const std::string& path);
35     static void RemoveFilesInDir(const std::string& path);
36     static void ClearFileContent(const std::string& fullPath);
37 };
38 } // namespace Media
39 } // namespace OHOS
40 #endif // HISTREAMER_FOUNDATION_OSAL_FILESYSTEM_FILE_SYSTEM_H
41