Rabbit-R1/android (non root)/smali/smali_classes3/com/google/zxing/oned/EAN8Writer.smali
2024-05-21 17:08:36 -04:00

243 lines
5.4 KiB
Smali

.class public final Lcom/google/zxing/oned/EAN8Writer;
.super Lcom/google/zxing/oned/UPCEANWriter;
.source "EAN8Writer.java"
# static fields
.field private static final CODE_WIDTH:I = 0x43
# direct methods
.method public constructor <init>()V
.locals 0
.line 31
invoke-direct {p0}, Lcom/google/zxing/oned/UPCEANWriter;-><init>()V
return-void
.end method
# virtual methods
.method public encode(Ljava/lang/String;)[Z
.locals 7
.line 49
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result p0
const/4 v0, 0x7
if-eq p0, v0, :cond_2
const/16 v1, 0x8
if-ne p0, v1, :cond_1
.line 63
:try_start_0
invoke-static {p1}, Lcom/google/zxing/oned/UPCEANReader;->checkStandardUPCEANChecksum(Ljava/lang/CharSequence;)Z
move-result p0
if-eqz p0, :cond_0
goto :goto_0
.line 64
:cond_0
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "Contents do not pass checksum"
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
:try_end_0
.catch Lcom/google/zxing/FormatException; {:try_start_0 .. :try_end_0} :catch_0
.line 67
:catch_0
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "Illegal contents"
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.line 71
:cond_1
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string v0, "Requested contents should be 7 or 8 digits long, but got "
invoke-static {p0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object p0
invoke-virtual {v0, p0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.line 55
:cond_2
:try_start_1
invoke-static {p1}, Lcom/google/zxing/oned/UPCEANReader;->getStandardUPCEANChecksum(Ljava/lang/CharSequence;)I
move-result p0
:try_end_1
.catch Lcom/google/zxing/FormatException; {:try_start_1 .. :try_end_1} :catch_1
.line 59
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
.line 75
:goto_0
invoke-static {p1}, Lcom/google/zxing/oned/EAN8Writer;->checkNumeric(Ljava/lang/String;)V
const/16 p0, 0x43
new-array p0, p0, [Z
.line 80
sget-object v1, Lcom/google/zxing/oned/UPCEANReader;->START_END_PATTERN:[I
const/4 v2, 0x0
const/4 v3, 0x1
invoke-static {p0, v2, v1, v3}, Lcom/google/zxing/oned/EAN8Writer;->appendPattern([ZI[IZ)I
move-result v1
move v4, v2
:goto_1
const/4 v5, 0x3
const/16 v6, 0xa
if-gt v4, v5, :cond_3
.line 83
invoke-virtual {p1, v4}, Ljava/lang/String;->charAt(I)C
move-result v5
invoke-static {v5, v6}, Ljava/lang/Character;->digit(CI)I
move-result v5
.line 84
sget-object v6, Lcom/google/zxing/oned/UPCEANReader;->L_PATTERNS:[[I
aget-object v5, v6, v5
invoke-static {p0, v1, v5, v2}, Lcom/google/zxing/oned/EAN8Writer;->appendPattern([ZI[IZ)I
move-result v5
add-int/2addr v1, v5
add-int/lit8 v4, v4, 0x1
goto :goto_1
.line 87
:cond_3
sget-object v4, Lcom/google/zxing/oned/UPCEANReader;->MIDDLE_PATTERN:[I
invoke-static {p0, v1, v4, v2}, Lcom/google/zxing/oned/EAN8Writer;->appendPattern([ZI[IZ)I
move-result v2
add-int/2addr v1, v2
const/4 v2, 0x4
:goto_2
if-gt v2, v0, :cond_4
.line 90
invoke-virtual {p1, v2}, Ljava/lang/String;->charAt(I)C
move-result v4
invoke-static {v4, v6}, Ljava/lang/Character;->digit(CI)I
move-result v4
.line 91
sget-object v5, Lcom/google/zxing/oned/UPCEANReader;->L_PATTERNS:[[I
aget-object v4, v5, v4
invoke-static {p0, v1, v4, v3}, Lcom/google/zxing/oned/EAN8Writer;->appendPattern([ZI[IZ)I
move-result v4
add-int/2addr v1, v4
add-int/lit8 v2, v2, 0x1
goto :goto_2
.line 93
:cond_4
sget-object p1, Lcom/google/zxing/oned/UPCEANReader;->START_END_PATTERN:[I
invoke-static {p0, v1, p1, v3}, Lcom/google/zxing/oned/EAN8Writer;->appendPattern([ZI[IZ)I
return-object p0
:catch_1
move-exception p0
.line 57
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/Throwable;)V
throw p1
.end method
.method protected getSupportedWriteFormats()Ljava/util/Collection;
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Collection<",
"Lcom/google/zxing/BarcodeFormat;",
">;"
}
.end annotation
.line 41
sget-object p0, Lcom/google/zxing/BarcodeFormat;->EAN_8:Lcom/google/zxing/BarcodeFormat;
invoke-static {p0}, Ljava/util/Collections;->singleton(Ljava/lang/Object;)Ljava/util/Set;
move-result-object p0
return-object p0
.end method