NetStringUtil.smali
.class public Laegon/chrome/net/NetStringUtil;
.super Ljava/lang/Object;
# annotations
.annotation runtime Laegon/chrome/base/annotations/JNINamespace;
value = "net::android"
.end annotation
# direct methods
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private static convertToUnicode(Ljava/nio/ByteBuffer;Ljava/lang/String;)Ljava/lang/String;
.registers 3
.annotation build Laegon/chrome/base/annotations/CalledByNative;
.end annotation
:try_start_0
invoke-static {p1}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object v0
invoke-virtual {v0}, Ljava/nio/charset/Charset;->newDecoder()Ljava/nio/charset/CharsetDecoder;
move-result-object v0
invoke-virtual {v0, p0}, Ljava/nio/charset/CharsetDecoder;->decode(Ljava/nio/ByteBuffer;)Ljava/nio/CharBuffer;
move-result-object v0
invoke-virtual {v0}, Ljava/nio/CharBuffer;->toString()Ljava/lang/String;
:try_end_f
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_f} :catch_11
move-result-object v0
:goto_10
return-object v0
:catch_11
move-exception v0
const/4 v0, 0x0
goto :goto_10
.end method
.method private static convertToUnicodeAndNormalize(Ljava/nio/ByteBuffer;Ljava/lang/String;)Ljava/lang/String;
.registers 4
.annotation build Laegon/chrome/base/annotations/CalledByNative;
.end annotation
invoke-static {p0, p1}, Laegon/chrome/net/NetStringUtil;->convertToUnicode(Ljava/nio/ByteBuffer;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
if-nez v0, :cond_8
const/4 v0, 0x0
:goto_7
return-object v0
:cond_8
sget-object v1, Ljava/text/Normalizer$Form;->NFC:Ljava/text/Normalizer$Form;
invoke-static {v0, v1}, Ljava/text/Normalizer;->normalize(Ljava/lang/CharSequence;Ljava/text/Normalizer$Form;)Ljava/lang/String;
move-result-object v0
goto :goto_7
.end method
.method private static convertToUnicodeWithSubstitutions(Ljava/nio/ByteBuffer;Ljava/lang/String;)Ljava/lang/String;
.registers 4
.annotation build Laegon/chrome/base/annotations/CalledByNative;
.end annotation
:try_start_0
invoke-static {p1}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object v0
invoke-virtual {v0}, Ljava/nio/charset/Charset;->newDecoder()Ljava/nio/charset/CharsetDecoder;
move-result-object v0
sget-object v1, Ljava/nio/charset/CodingErrorAction;->REPLACE:Ljava/nio/charset/CodingErrorAction;
invoke-virtual {v0, v1}, Ljava/nio/charset/CharsetDecoder;->onMalformedInput(Ljava/nio/charset/CodingErrorAction;)Ljava/nio/charset/CharsetDecoder;
sget-object v1, Ljava/nio/charset/CodingErrorAction;->REPLACE:Ljava/nio/charset/CodingErrorAction;
invoke-virtual {v0, v1}, Ljava/nio/charset/CharsetDecoder;->onUnmappableCharacter(Ljava/nio/charset/CodingErrorAction;)Ljava/nio/charset/CharsetDecoder;
const-string v1, "\ufffd"
invoke-virtual {v0, v1}, Ljava/nio/charset/CharsetDecoder;->replaceWith(Ljava/lang/String;)Ljava/nio/charset/CharsetDecoder;
invoke-virtual {v0, p0}, Ljava/nio/charset/CharsetDecoder;->decode(Ljava/nio/ByteBuffer;)Ljava/nio/CharBuffer;
move-result-object v0
invoke-virtual {v0}, Ljava/nio/CharBuffer;->toString()Ljava/lang/String;
:try_end_1e
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_1e} :catch_20
move-result-object v0
:goto_1f
return-object v0
:catch_20
move-exception v0
const/4 v0, 0x0
goto :goto_1f
.end method
.method private static toUpperCase(Ljava/lang/String;)Ljava/lang/String;
.registers 2
.annotation build Laegon/chrome/base/annotations/CalledByNative;
.end annotation
:try_start_0
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
move-result-object v0
invoke-virtual {p0, v0}, Ljava/lang/String;->toUpperCase(Ljava/util/Locale;)Ljava/lang/String;
:try_end_7
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_7} :catch_9
move-result-object v0
:goto_8
return-object v0
:catch_9
move-exception v0
const/4 v0, 0x0
goto :goto_8
.end method