得物.apk(点击下载) / a.java


package com.ta.utdid2.b.a;

import a.f;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import org.xmlpull.v1.XmlSerializer;

public class a implements XmlSerializer {

    /* renamed from: a  reason: collision with root package name */
    private static final String[] f26414a = {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, """, null, null, null, "&", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "<", null, ">", null};

    /* renamed from: a  reason: collision with other field name */
    private OutputStream f95a;

    /* renamed from: a  reason: collision with other field name */
    private Writer f96a;

    /* renamed from: a  reason: collision with other field name */
    private ByteBuffer f97a = ByteBuffer.allocate(AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED);

    /* renamed from: a  reason: collision with other field name */
    private CharsetEncoder f98a;
    private final char[] b = new char[AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED];
    private boolean i;
    private int mPos;

    private void a(String str, int i3, int i12) throws IOException {
        if (i12 > 8192) {
            int i13 = i12 + i3;
            while (i3 < i13) {
                int i14 = i3 + AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED;
                a(str, i3, i14 < i13 ? AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED : i13 - i3);
                i3 = i14;
            }
            return;
        }
        int i15 = this.mPos;
        if (i15 + i12 > 8192) {
            flush();
            i15 = this.mPos;
        }
        str.getChars(i3, i3 + i12, this.b, i15);
        this.mPos = i15 + i12;
    }

    private void append(char c5) throws IOException {
        int i3 = this.mPos;
        if (i3 >= 8191) {
            flush();
            i3 = this.mPos;
        }
        this.b[i3] = c5;
        this.mPos = i3 + 1;
    }

    private void d(String str) throws IOException {
        String str2;
        int length = str.length();
        String[] strArr = f26414a;
        char length2 = (char) strArr.length;
        int i3 = 0;
        int i12 = 0;
        while (i3 < length) {
            char charAt = str.charAt(i3);
            if (charAt < length2 && (str2 = strArr[charAt]) != null) {
                if (i12 < i3) {
                    a(str, i12, i3 - i12);
                }
                i12 = i3 + 1;
                append(str2);
            }
            i3++;
        }
        if (i12 < i3) {
            a(str, i12, i3 - i12);
        }
    }

    private void g() throws IOException {
        int position = this.f97a.position();
        if (position > 0) {
            this.f97a.flip();
            this.f95a.write(this.f97a.array(), 0, position);
            this.f97a.clear();
        }
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public XmlSerializer attribute(String str, String str2, String str3) throws IOException, IllegalArgumentException, IllegalStateException {
        append(' ');
        if (str != null) {
            append(str);
            append(':');
        }
        append(str2);
        append("=\"");
        d(str3);
        append('\"');
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void cdsect(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void comment(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void docdecl(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void endDocument() throws IOException, IllegalArgumentException, IllegalStateException {
        flush();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public XmlSerializer endTag(String str, String str2) throws IOException, IllegalArgumentException, IllegalStateException {
        if (this.i) {
            append(" />\n");
        } else {
            append("</");
            if (str != null) {
                append(str);
                append(':');
            }
            append(str2);
            append(">\n");
        }
        this.i = false;
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void entityRef(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void flush() throws IOException {
        int i3 = this.mPos;
        if (i3 > 0) {
            if (this.f95a != null) {
                CharBuffer wrap = CharBuffer.wrap(this.b, 0, i3);
                CoderResult encode = this.f98a.encode(wrap, this.f97a, true);
                while (!encode.isError()) {
                    if (encode.isOverflow()) {
                        g();
                        encode = this.f98a.encode(wrap, this.f97a, true);
                    } else {
                        g();
                        this.f95a.flush();
                    }
                }
                throw new IOException(encode.toString());
            }
            this.f96a.write(this.b, 0, i3);
            this.f96a.flush();
            this.mPos = 0;
        }
    }

    public int getDepth() {
        throw new UnsupportedOperationException();
    }

    public boolean getFeature(String str) {
        throw new UnsupportedOperationException();
    }

    public String getName() {
        throw new UnsupportedOperationException();
    }

    public String getNamespace() {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public String getPrefix(String str, boolean z) throws IllegalArgumentException {
        throw new UnsupportedOperationException();
    }

    public Object getProperty(String str) {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void ignorableWhitespace(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void processingInstruction(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void setFeature(String str, boolean z) throws IllegalArgumentException, IllegalStateException {
        if (!str.equals("http://xmlpull.org/v1/doc/features.html#indent-output")) {
            throw new UnsupportedOperationException();
        }
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void setOutput(OutputStream outputStream, String str) throws IOException, IllegalArgumentException, IllegalStateException {
        if (outputStream != null) {
            try {
                this.f98a = Charset.forName(str).newEncoder();
                this.f95a = outputStream;
            } catch (IllegalCharsetNameException e) {
                throw ((UnsupportedEncodingException) new UnsupportedEncodingException(str).initCause(e));
            } catch (UnsupportedCharsetException e6) {
                throw ((UnsupportedEncodingException) new UnsupportedEncodingException(str).initCause(e6));
            }
        } else {
            throw new IllegalArgumentException();
        }
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void setPrefix(String str, String str2) throws IOException, IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void setProperty(String str, Object obj) throws IllegalArgumentException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void startDocument(String str, Boolean bool) throws IOException, IllegalArgumentException, IllegalStateException {
        append(f.g(f.h("<?xml version='1.0' encoding='utf-8' standalone='"), bool.booleanValue() ? "yes" : "no", "' ?>\n"));
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public XmlSerializer startTag(String str, String str2) throws IOException, IllegalArgumentException, IllegalStateException {
        if (this.i) {
            append(">\n");
        }
        append('<');
        if (str != null) {
            append(str);
            append(':');
        }
        append(str2);
        this.i = true;
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public XmlSerializer text(char[] cArr, int i3, int i12) throws IOException, IllegalArgumentException, IllegalStateException {
        if (this.i) {
            append(">");
            this.i = false;
        }
        a(cArr, i3, i12);
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public XmlSerializer text(String str) throws IOException, IllegalArgumentException, IllegalStateException {
        if (this.i) {
            append(">");
            this.i = false;
        }
        d(str);
        return this;
    }

    private void append(char[] cArr, int i3, int i12) throws IOException {
        if (i12 > 8192) {
            int i13 = i12 + i3;
            while (i3 < i13) {
                int i14 = i3 + AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED;
                append(cArr, i3, i14 < i13 ? AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED : i13 - i3);
                i3 = i14;
            }
            return;
        }
        int i15 = this.mPos;
        if (i15 + i12 > 8192) {
            flush();
            i15 = this.mPos;
        }
        System.arraycopy(cArr, i3, this.b, i15, i12);
        this.mPos = i15 + i12;
    }

    private void a(char[] cArr, int i3, int i12) throws IOException {
        String str;
        String[] strArr = f26414a;
        char length = (char) strArr.length;
        int i13 = i12 + i3;
        int i14 = i3;
        while (i3 < i13) {
            char c5 = cArr[i3];
            if (c5 < length && (str = strArr[c5]) != null) {
                if (i14 < i3) {
                    append(cArr, i14, i3 - i14);
                }
                i14 = i3 + 1;
                append(str);
            }
            i3++;
        }
        if (i14 < i3) {
            append(cArr, i14, i3 - i14);
        }
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public void setOutput(Writer writer) throws IOException, IllegalArgumentException, IllegalStateException {
        this.f96a = writer;
    }

    private void append(String str) throws IOException {
        a(str, 0, str.length());
    }
}