115 lines
2.4 KiB
Java
115 lines
2.4 KiB
Java
package com.google.zxing.datamatrix.encoder;
|
|
|
|
import com.google.zxing.Dimension;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class EncoderContext {
|
|
private final String a;
|
|
private SymbolShapeHint b;
|
|
private Dimension c;
|
|
private Dimension d;
|
|
private final StringBuilder e;
|
|
int f;
|
|
private int g;
|
|
private SymbolInfo h;
|
|
private int i;
|
|
|
|
EncoderContext(String str) {
|
|
byte[] bytes = str.getBytes(StandardCharsets.ISO_8859_1);
|
|
StringBuilder sb = new StringBuilder(bytes.length);
|
|
int length = bytes.length;
|
|
for (int i = 0; i < length; i++) {
|
|
char c = (char) (bytes[i] & 255);
|
|
if (c == '?' && str.charAt(i) != '?') {
|
|
throw new IllegalArgumentException("Message contains characters outside ISO-8859-1 encoding.");
|
|
}
|
|
sb.append(c);
|
|
}
|
|
this.a = sb.toString();
|
|
this.b = SymbolShapeHint.FORCE_NONE;
|
|
this.e = new StringBuilder(str.length());
|
|
this.g = -1;
|
|
}
|
|
|
|
private int l() {
|
|
return this.a.length() - this.i;
|
|
}
|
|
|
|
public void a(SymbolShapeHint symbolShapeHint) {
|
|
this.b = symbolShapeHint;
|
|
}
|
|
|
|
public StringBuilder b() {
|
|
return this.e;
|
|
}
|
|
|
|
public char c() {
|
|
return this.a.charAt(this.f);
|
|
}
|
|
|
|
public String d() {
|
|
return this.a;
|
|
}
|
|
|
|
public int e() {
|
|
return this.g;
|
|
}
|
|
|
|
public int f() {
|
|
return l() - this.f;
|
|
}
|
|
|
|
public SymbolInfo g() {
|
|
return this.h;
|
|
}
|
|
|
|
public boolean h() {
|
|
return this.f < l();
|
|
}
|
|
|
|
public void i() {
|
|
this.g = -1;
|
|
}
|
|
|
|
public void j() {
|
|
this.h = null;
|
|
}
|
|
|
|
public void k() {
|
|
c(a());
|
|
}
|
|
|
|
public void a(Dimension dimension, Dimension dimension2) {
|
|
this.c = dimension;
|
|
this.d = dimension2;
|
|
}
|
|
|
|
public void b(int i) {
|
|
this.g = i;
|
|
}
|
|
|
|
public void c(int i) {
|
|
SymbolInfo symbolInfo = this.h;
|
|
if (symbolInfo == null || i > symbolInfo.a()) {
|
|
this.h = SymbolInfo.a(i, this.b, this.c, this.d, true);
|
|
}
|
|
}
|
|
|
|
public void a(int i) {
|
|
this.i = i;
|
|
}
|
|
|
|
public void a(String str) {
|
|
this.e.append(str);
|
|
}
|
|
|
|
public void a(char c) {
|
|
this.e.append(c);
|
|
}
|
|
|
|
public int a() {
|
|
return this.e.length();
|
|
}
|
|
}
|