Files
rr3-apk/decompiled-community/sources/com/amazonaws/util/NamespaceRemovingInputStream.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

120 lines
3.8 KiB
Java

package com.amazonaws.util;
import com.amazonaws.internal.SdkFilterInputStream;
import com.ironsource.v8;
import java.io.BufferedInputStream;
import java.io.FilterInputStream;
import java.io.InputStream;
/* loaded from: classes.dex */
class NamespaceRemovingInputStream extends SdkFilterInputStream {
public boolean hasRemovedNamespace;
public final byte[] lookAheadData;
public NamespaceRemovingInputStream(InputStream inputStream) {
super(new BufferedInputStream(inputStream));
this.lookAheadData = new byte[200];
this.hasRemovedNamespace = false;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read() {
abortIfNeeded();
int read = ((FilterInputStream) this).in.read();
if (read != 120 || this.hasRemovedNamespace) {
return read;
}
this.lookAheadData[0] = (byte) read;
((FilterInputStream) this).in.mark(this.lookAheadData.length);
InputStream inputStream = ((FilterInputStream) this).in;
byte[] bArr = this.lookAheadData;
int read2 = inputStream.read(bArr, 1, bArr.length - 1);
((FilterInputStream) this).in.reset();
int matchXmlNamespaceAttribute = matchXmlNamespaceAttribute(new String(this.lookAheadData, 0, read2 + 1, StringUtils.UTF8));
if (matchXmlNamespaceAttribute <= 0) {
return read;
}
for (int i = 0; i < matchXmlNamespaceAttribute - 1; i++) {
((FilterInputStream) this).in.read();
}
int read3 = ((FilterInputStream) this).in.read();
this.hasRemovedNamespace = true;
return read3;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read(byte[] bArr, int i, int i2) {
for (int i3 = 0; i3 < i2; i3++) {
int read = read();
if (read == -1) {
if (i3 == 0) {
return -1;
}
return i3;
}
bArr[i3 + i] = (byte) read;
}
return i2;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read(byte[] bArr) {
return read(bArr, 0, bArr.length);
}
public final int matchXmlNamespaceAttribute(String str) {
StringPrefixSlicer stringPrefixSlicer = new StringPrefixSlicer(str);
if (!stringPrefixSlicer.removePrefix("xmlns")) {
return -1;
}
stringPrefixSlicer.removeRepeatingPrefix(" ");
if (!stringPrefixSlicer.removePrefix(v8.i.b)) {
return -1;
}
stringPrefixSlicer.removeRepeatingPrefix(" ");
if (stringPrefixSlicer.removePrefix("\"") && stringPrefixSlicer.removePrefixEndingWith("\"")) {
return str.length() - stringPrefixSlicer.getString().length();
}
return -1;
}
public static final class StringPrefixSlicer {
public String s;
public String getString() {
return this.s;
}
public StringPrefixSlicer(String str) {
this.s = str;
}
public boolean removePrefix(String str) {
if (!this.s.startsWith(str)) {
return false;
}
this.s = this.s.substring(str.length());
return true;
}
public boolean removeRepeatingPrefix(String str) {
if (!this.s.startsWith(str)) {
return false;
}
while (this.s.startsWith(str)) {
this.s = this.s.substring(str.length());
}
return true;
}
public boolean removePrefixEndingWith(String str) {
int indexOf = this.s.indexOf(str);
if (indexOf < 0) {
return false;
}
this.s = this.s.substring(indexOf + str.length());
return true;
}
}
}