Clean code

This commit is contained in:
FongMi 2023-06-01 14:00:44 +08:00
parent 90ff5c9376
commit 34d7c2bb97
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ public class Utils {
return hasCamera && hasPhone && hasBT; return hasCamera && hasPhone && hasBT;
} }
public static boolean isGBK(byte[] bytes) { public static boolean isGbk(byte[] bytes) {
Charset charset = Charset.forName("GBK"); Charset charset = Charset.forName("GBK");
String str = new String(bytes, charset); String str = new String(bytes, charset);
byte[] newBytes = str.getBytes(charset); byte[] newBytes = str.getBytes(charset);
@ -57,7 +57,7 @@ public class Utils {
} }
public static byte[] toUtf8(byte[] bytes) throws Exception { public static byte[] toUtf8(byte[] bytes) throws Exception {
return isGBK(bytes) ? new String(bytes, Charset.forName("GBK")).getBytes("UTF-8") : bytes; return isGbk(bytes) ? new String(bytes, Charset.forName("GBK")).getBytes("UTF-8") : bytes;
} }
public static boolean isSub(String ext) { public static boolean isSub(String ext) {