what-the-bank/sources/com/google/android/gms/common/util/DataUtils.java

29 lines
1.0 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.common.util;
import android.database.CharArrayBuffer;
import android.graphics.Bitmap;
import android.text.TextUtils;
import java.io.ByteArrayOutputStream;
/* loaded from: classes2.dex */
public final class DataUtils {
public static void copyStringToBuffer(String str, CharArrayBuffer charArrayBuffer) {
if (TextUtils.isEmpty(str)) {
charArrayBuffer.sizeCopied = 0;
return;
}
if (charArrayBuffer.data == null || charArrayBuffer.data.length < str.length()) {
charArrayBuffer.data = str.toCharArray();
} else {
str.getChars(0, str.length(), charArrayBuffer.data, 0);
}
charArrayBuffer.sizeCopied = str.length();
}
public static byte[] loadImageBytes(Bitmap bitmap) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
return byteArrayOutputStream.toByteArray();
}
}