• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 
16 package ohos.restool;
17 
18 import ohos.BundleException;
19 import ohos.ResourceIndexResult;
20 
21 import java.util.HashMap;
22 import java.util.List;
23 
24 /**
25  * Resources Parser Interface.
26  *
27  * @since 2025-06-06
28  */
29 public interface ResourcesParser {
30     /**
31      * Get resource value by resource id.
32      *
33      * @param resourceId resource id
34      * @param data       resource index data
35      * @return the resource value
36      * @throws BundleException IOException.
37      */
getResourceById(int resourceId, byte[] data)38     String getResourceById(int resourceId, byte[] data) throws BundleException;
39 
40     /**
41      * Get base resource value by resource id.
42      *
43      * @param resourceId resource id
44      * @param data resource index data
45      * @return the resource value
46      * @throws BundleException IOException.
47      */
getBaseResourceById(int resourceId, byte[] data)48     String getBaseResourceById(int resourceId, byte[] data) throws BundleException;
49 
50     /**
51      * Read all config item.
52      *
53      * @param data config byte buffer
54      * @return the item info.
55      */
getAllDataItem(byte[] data)56     List<ResourceIndexResult> getAllDataItem(byte[] data);
57 
58     /**
59      * Read resource map by id.
60      *
61      * @param resId The resource ID to query
62      * @param data config byte buffer
63      * @return the resource map of id.
64      */
getResourceMapById(int resId, byte[] data)65     HashMap<String, String> getResourceMapById(int resId, byte[] data);
66 
67     /**
68      * Gets the resource string value by ID
69      *
70      * @param resId The resource ID to query
71      * @param data The resource data buffer
72      * @return The string value of the resource
73      */
getResourceStringById(int resId, byte[] data)74     String getResourceStringById(int resId, byte[] data);
75 }
76