mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-04 19:48:54 +01:00
73 lines
2.7 KiB
Java
73 lines
2.7 KiB
Java
package org.apache.commons.io;
|
|
|
|
import defpackage.a$$ExternalSyntheticOutline0;
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.nio.charset.Charset;
|
|
import org.apache.commons.lang3.SystemProperties;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes10.dex */
|
|
public class HexDump {
|
|
public static final String EOL = System.getProperty(SystemProperties.LINE_SEPARATOR);
|
|
private static final char[] _hexcodes = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
private static final int[] _shifts = {28, 24, 20, 16, 12, 8, 4, 0};
|
|
|
|
public static void dump(byte[] bArr, long j, OutputStream outputStream, int i) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException {
|
|
if (i < 0 || i >= bArr.length) {
|
|
StringBuilder m0m = a$$ExternalSyntheticOutline0.m0m(i, "illegal index: ", " into array of length ");
|
|
m0m.append(bArr.length);
|
|
throw new ArrayIndexOutOfBoundsException(m0m.toString());
|
|
}
|
|
if (outputStream == null) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3("cannot write to nullstream");
|
|
return;
|
|
}
|
|
long j2 = j + i;
|
|
StringBuilder sb = new StringBuilder(74);
|
|
while (i < bArr.length) {
|
|
int length = bArr.length - i;
|
|
if (length > 16) {
|
|
length = 16;
|
|
}
|
|
dump(sb, j2).append(' ');
|
|
for (int i2 = 0; i2 < 16; i2++) {
|
|
if (i2 < length) {
|
|
dump(sb, bArr[i2 + i]);
|
|
} else {
|
|
sb.append(" ");
|
|
}
|
|
sb.append(' ');
|
|
}
|
|
for (int i3 = 0; i3 < length; i3++) {
|
|
byte b = bArr[i3 + i];
|
|
if (b < 32 || b >= Byte.MAX_VALUE) {
|
|
sb.append('.');
|
|
} else {
|
|
sb.append((char) b);
|
|
}
|
|
}
|
|
sb.append(EOL);
|
|
outputStream.write(sb.toString().getBytes(Charset.defaultCharset()));
|
|
outputStream.flush();
|
|
sb.setLength(0);
|
|
j2 += length;
|
|
i += 16;
|
|
}
|
|
}
|
|
|
|
private static StringBuilder dump(StringBuilder sb, long j) {
|
|
for (int i = 0; i < 8; i++) {
|
|
sb.append(_hexcodes[((int) (j >> _shifts[i])) & 15]);
|
|
}
|
|
return sb;
|
|
}
|
|
|
|
private static StringBuilder dump(StringBuilder sb, byte b) {
|
|
for (int i = 0; i < 2; i++) {
|
|
sb.append(_hexcodes[(b >> _shifts[i + 6]) & 15]);
|
|
}
|
|
return sb;
|
|
}
|
|
}
|