Rabbit-R1/android (non root)/java/sources/com/google/zxing/datamatrix/encoder/TextEncoder.java
2024-05-21 17:08:36 -04:00

63 lines
1.7 KiB
Java

package com.google.zxing.datamatrix.encoder;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public final class TextEncoder extends C40Encoder {
@Override // com.google.zxing.datamatrix.encoder.C40Encoder, com.google.zxing.datamatrix.encoder.Encoder
public int getEncodingMode() {
return 2;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
int encodeChar(char c, StringBuilder sb) {
if (c == ' ') {
sb.append((char) 3);
return 1;
}
if (c >= '0' && c <= '9') {
sb.append((char) (c - ','));
return 1;
}
if (c >= 'a' && c <= 'z') {
sb.append((char) (c - 'S'));
return 1;
}
if (c < ' ') {
sb.append((char) 0);
sb.append(c);
return 2;
}
if (c <= '/') {
sb.append((char) 1);
sb.append((char) (c - '!'));
return 2;
}
if (c <= '@') {
sb.append((char) 1);
sb.append((char) (c - '+'));
return 2;
}
if (c >= '[' && c <= '_') {
sb.append((char) 1);
sb.append((char) (c - 'E'));
return 2;
}
if (c == '`') {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
if (c <= 'Z') {
sb.append((char) 2);
sb.append((char) (c - '@'));
return 2;
}
if (c <= 127) {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
sb.append("\u0001\u001e");
return encodeChar((char) (c - 128), sb) + 2;
}
}