mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-04 19:48:54 +01:00
107 lines
3.5 KiB
Java
107 lines
3.5 KiB
Java
package org.apache.commons.io;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Locale;
|
|
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
|
|
import org.apache.commons.net.telnet.TelnetCommand;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes10.dex */
|
|
public class ByteOrderMark implements Serializable {
|
|
public static final char UTF_BOM = 65279;
|
|
private static final long serialVersionUID = 1;
|
|
private final int[] bytes;
|
|
private final String charsetName;
|
|
public static final ByteOrderMark UTF_8 = new ByteOrderMark("UTF-8", TelnetCommand.EOR, 187, 191);
|
|
public static final ByteOrderMark UTF_16BE = new ByteOrderMark("UTF-16BE", TelnetCommand.DONT, 255);
|
|
public static final ByteOrderMark UTF_16LE = new ByteOrderMark("UTF-16LE", 255, TelnetCommand.DONT);
|
|
public static final ByteOrderMark UTF_32BE = new ByteOrderMark("UTF-32BE", 0, 0, TelnetCommand.DONT, 255);
|
|
public static final ByteOrderMark UTF_32LE = new ByteOrderMark("UTF-32LE", 255, TelnetCommand.DONT, 0, 0);
|
|
|
|
public ByteOrderMark(String str, int... iArr) {
|
|
if (str == null || str.isEmpty()) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("No charsetName specified");
|
|
throw null;
|
|
}
|
|
if (iArr == null || iArr.length == 0) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("No bytes specified");
|
|
throw null;
|
|
}
|
|
this.charsetName = str;
|
|
int[] iArr2 = new int[iArr.length];
|
|
this.bytes = iArr2;
|
|
System.arraycopy(iArr, 0, iArr2, 0, iArr.length);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (!(obj instanceof ByteOrderMark)) {
|
|
return false;
|
|
}
|
|
ByteOrderMark byteOrderMark = (ByteOrderMark) obj;
|
|
if (this.bytes.length != byteOrderMark.length()) {
|
|
return false;
|
|
}
|
|
int i = 0;
|
|
while (true) {
|
|
int[] iArr = this.bytes;
|
|
if (i >= iArr.length) {
|
|
return true;
|
|
}
|
|
if (iArr[i] != byteOrderMark.get(i)) {
|
|
return false;
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
|
|
public int get(int i) {
|
|
return this.bytes[i];
|
|
}
|
|
|
|
public byte[] getBytes() {
|
|
byte[] byteArray = IOUtils.byteArray(this.bytes.length);
|
|
int i = 0;
|
|
while (true) {
|
|
int[] iArr = this.bytes;
|
|
if (i >= iArr.length) {
|
|
return byteArray;
|
|
}
|
|
byteArray[i] = (byte) iArr[i];
|
|
i++;
|
|
}
|
|
}
|
|
|
|
public String getCharsetName() {
|
|
return this.charsetName;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int hashCode = getClass().hashCode();
|
|
for (int i : this.bytes) {
|
|
hashCode += i;
|
|
}
|
|
return hashCode;
|
|
}
|
|
|
|
public int length() {
|
|
return this.bytes.length;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(getClass().getSimpleName());
|
|
sb.append(AbstractJsonLexerKt.BEGIN_LIST);
|
|
sb.append(this.charsetName);
|
|
sb.append(": ");
|
|
for (int i = 0; i < this.bytes.length; i++) {
|
|
if (i > 0) {
|
|
sb.append(",");
|
|
}
|
|
sb.append("0x");
|
|
sb.append(Integer.toHexString(this.bytes[i] & 255).toUpperCase(Locale.ROOT));
|
|
}
|
|
sb.append(AbstractJsonLexerKt.END_LIST);
|
|
return sb.toString();
|
|
}
|
|
}
|