diff --git a/adapter/ohos/restool/ResourcesParserV1.java b/adapter/ohos/restool/ResourcesParserV1.java index 3a1208cdef971d55c900d59337c3ace671ef9d6d..ed9442cfce0fbabd8cab8cd40ea5823315403ac1 100644 --- a/adapter/ohos/restool/ResourcesParserV1.java +++ b/adapter/ohos/restool/ResourcesParserV1.java @@ -223,6 +223,7 @@ public class ResourcesParserV1 implements ResourcesParser { * @return the resourceId value * @throws BundleException IOException. */ + @Override public String getResourceById(int resourceId, byte[] data) throws BundleException { String resourceIdValue = ""; if (data == null || data.length <= 0 || resourceId == RESOURCE_DEFAULT_ID) { @@ -245,6 +246,7 @@ public class ResourcesParserV1 implements ResourcesParser { * @return the resource value * @throws BundleException IOException. */ + @Override public String getBaseResourceById(int resourceId, byte[] data) throws BundleException { String resourceIdValue = ""; if (data == null || data.length <= 0 || resourceId == RESOURCE_DEFAULT_ID) { @@ -446,6 +448,7 @@ public class ResourcesParserV1 implements ResourcesParser { * @param data config byte buffer * @return the item info. */ + @Override public List getAllDataItem(byte[] data) { ByteBuffer byteBuf = ByteBuffer.wrap(data); byteBuf.order(ByteOrder.LITTLE_ENDIAN); @@ -464,6 +467,7 @@ public class ResourcesParserV1 implements ResourcesParser { * @param data config byte buffer * @return the resource map of id. */ + @Override public HashMap getResourceMapById(int resId, byte[] data) { List resources = getAllDataItem(data); HashMap resourceMap = new HashMap<>(); @@ -482,6 +486,7 @@ public class ResourcesParserV1 implements ResourcesParser { * @param data config byte buffer * @return the resource. */ + @Override public String getResourceStringById(int resId, byte[] data) { List resources = getAllDataItem(data); for (ResourceIndexResult indexResult : resources) { diff --git a/adapter/ohos/restool/ResourcesParserV2.java b/adapter/ohos/restool/ResourcesParserV2.java index 19cf64bc6f3963c27790db3c767a8884fd0f3f79..c0c3d320536a298659fe796c37a6355a873441f5 100644 --- a/adapter/ohos/restool/ResourcesParserV2.java +++ b/adapter/ohos/restool/ResourcesParserV2.java @@ -308,6 +308,7 @@ public class ResourcesParserV2 implements ResourcesParser { * @return the resourceId value * @throws BundleException IOException. */ + @Override public String getResourceById(int resourceId, byte[] data) throws BundleException { String resourceIdValue = ""; if (data == null || data.length <= 0 || resourceId == RESOURCE_DEFAULT_ID) { @@ -330,6 +331,7 @@ public class ResourcesParserV2 implements ResourcesParser { * @return the resource value * @throws BundleException IOException. */ + @Override public String getBaseResourceById(int resourceId, byte[] data) throws BundleException { String resourceIdValue = ""; if (data == null || data.length <= 0 || resourceId == RESOURCE_DEFAULT_ID) { @@ -467,6 +469,7 @@ public class ResourcesParserV2 implements ResourcesParser { * @param data config byte buffer * @return the item info. */ + @Override public List getAllDataItem(byte[] data) { ByteBuffer byteBuf = ByteBuffer.wrap(data); byteBuf.order(ByteOrder.LITTLE_ENDIAN); @@ -486,6 +489,7 @@ public class ResourcesParserV2 implements ResourcesParser { * @param data config byte buffer * @return the resource map of id. */ + @Override public HashMap getResourceMapById(int resId, byte[] data) { List resources = getAllDataItem(data); HashMap resourceMap = new HashMap<>(); @@ -504,6 +508,7 @@ public class ResourcesParserV2 implements ResourcesParser { * @param data config byte buffer * @return resource */ + @Override public String getResourceStringById(int resId, byte[] data) { List resources = getAllDataItem(data); for (ResourceIndexResult indexResult : resources) { @@ -532,11 +537,11 @@ public class ResourcesParserV2 implements ResourcesParser { .values() .forEach( dataItemV2 -> { - if (dataItemV2.resCfgId == index.resCfgId) { - resourceIndexResults.add( - parseDataItems(dataItemV2, configClass)); - } - })); + if (dataItemV2.resCfgId == index.resCfgId) { + resourceIndexResults.add( + parseDataItems(dataItemV2, configClass)); + } + })); } return resourceIndexResults; } @@ -669,8 +674,8 @@ public class ResourcesParserV2 implements ResourcesParser { boolean isLastLanguageRegionScript = lastKeyType != null && (lastKeyType == ConfigType.LANGUAGE - || lastKeyType == ConfigType.REGION - || lastKeyType == ConfigType.SCRIPT); + || lastKeyType == ConfigType.REGION + || lastKeyType == ConfigType.SCRIPT); return isCurrentMccMnc || isLastLanguageRegionScript; } @@ -818,7 +823,7 @@ public class ResourcesParserV2 implements ResourcesParser { dataItemV2 -> { dataItemV2.type = idssItemV2.type; dataItemV2.name = idssItemV2.name; - }); + }); map.put(idssItemV2.resId, idssItemV2); } idssMap.put(type, map);