TikTok.apk(点击下载) / C19800qX.java


package X;

import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.effectmanager.common.utils.FileUtils;
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;

/* renamed from: X.0qX  reason: invalid class name and case insensitive filesystem */
public final class C19800qX implements XmlSerializer {
    public static final String[] LIZ = {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};
    public final char[] LIZIZ = new char[FileUtils.BUFFER_SIZE];
    public int LIZJ;
    public Writer LIZLLL;
    public OutputStream LJ;
    public CharsetEncoder LJFF;
    public ByteBuffer LJI = ByteBuffer.allocate(FileUtils.BUFFER_SIZE);
    public boolean LJII;

    static {
        Covode.recordClassIndex(102525);
    }

    private void LIZ() {
        int position = this.LJI.position();
        if (position > 0) {
            this.LJI.flip();
            this.LJ.write(this.LJI.array(), 0, position);
            this.LJI.clear();
        }
    }

    private void LIZ(char c) {
        int i2 = this.LIZJ;
        if (i2 >= 8191) {
            flush();
            i2 = this.LIZJ;
        }
        this.LIZIZ[i2] = c;
        this.LIZJ = i2 + 1;
    }

    private void LIZ(String str) {
        LIZ(str, 0, str.length());
    }

    private void LIZ(String str, int i2, int i3) {
        if (i3 > 8192) {
            int i4 = i3 + i2;
            while (i2 < i4) {
                int i5 = i2 + FileUtils.BUFFER_SIZE;
                LIZ(str, i2, i5 < i4 ? FileUtils.BUFFER_SIZE : i4 - i2);
                i2 = i5;
            }
            return;
        }
        int i6 = this.LIZJ;
        if (i6 + i3 > 8192) {
            flush();
            i6 = this.LIZJ;
        }
        str.getChars(i2, i2 + i3, this.LIZIZ, i6);
        this.LIZJ = i6 + i3;
    }

    private void LIZ(char[] cArr, int i2, int i3) {
        if (i3 > 8192) {
            int i4 = i3 + i2;
            while (i2 < i4) {
                int i5 = i2 + FileUtils.BUFFER_SIZE;
                LIZ(cArr, i2, i5 < i4 ? FileUtils.BUFFER_SIZE : i4 - i2);
                i2 = i5;
            }
            return;
        }
        int i6 = this.LIZJ;
        if (i6 + i3 > 8192) {
            flush();
            i6 = this.LIZJ;
        }
        System.arraycopy(cArr, i2, this.LIZIZ, i6, i3);
        this.LIZJ = i6 + i3;
    }

    private void LIZIZ(String str) {
        String str2;
        int length = str.length();
        String[] strArr = LIZ;
        char length2 = (char) strArr.length;
        int i2 = 0;
        int i3 = 0;
        while (i2 < length) {
            char charAt = str.charAt(i2);
            if (charAt < length2 && (str2 = strArr[charAt]) != null) {
                if (i3 < i2) {
                    LIZ(str, i3, i2 - i3);
                }
                i3 = i2 + 1;
                LIZ(str2);
            }
            i2++;
        }
        if (i3 < i2) {
            LIZ(str, i3, i2 - i3);
        }
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final XmlSerializer attribute(String str, String str2, String str3) {
        LIZ(' ');
        if (str != null) {
            LIZ(str);
            LIZ(':');
        }
        LIZ(str2);
        LIZ("=\"");
        LIZIZ(str3);
        LIZ('\"');
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void cdsect(String str) {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void comment(String str) {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void docdecl(String str) {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void endDocument() {
        flush();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final XmlSerializer endTag(String str, String str2) {
        if (this.LJII) {
            LIZ(" />\n");
        } else {
            LIZ("</");
            if (str != null) {
                LIZ(str);
                LIZ(':');
            }
            LIZ(str2);
            LIZ(">\n");
        }
        this.LJII = false;
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void entityRef(String str) {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void flush() {
        int i2 = this.LIZJ;
        if (i2 > 0) {
            if (this.LJ != null) {
                CharBuffer wrap = CharBuffer.wrap(this.LIZIZ, 0, i2);
                CoderResult encode = this.LJFF.encode(wrap, this.LJI, true);
                while (!encode.isError()) {
                    if (encode.isOverflow()) {
                        LIZ();
                        encode = this.LJFF.encode(wrap, this.LJI, true);
                    } else {
                        LIZ();
                        this.LJ.flush();
                    }
                }
                throw new IOException(encode.toString());
            }
            this.LIZLLL.write(this.LIZIZ, 0, i2);
            this.LIZLLL.flush();
            this.LIZJ = 0;
        }
    }

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

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

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

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

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

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

    @Override // org.xmlpull.v1.XmlSerializer
    public final void ignorableWhitespace(String str) {
        throw new UnsupportedOperationException();
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final void processingInstruction(String str) {
        throw new UnsupportedOperationException();
    }

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

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

    @Override // org.xmlpull.v1.XmlSerializer
    public final void setOutput(Writer writer) {
        this.LIZLLL = writer;
    }

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

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

    @Override // org.xmlpull.v1.XmlSerializer
    public final void startDocument(String str, Boolean bool) {
        LIZ("<?xml version='1.0' encoding='utf-8' standalone='" + (bool.booleanValue() ? "yes" : "no") + "' ?>\n");
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final XmlSerializer startTag(String str, String str2) {
        if (this.LJII) {
            LIZ(">\n");
        }
        LIZ('<');
        if (str != null) {
            LIZ(str);
            LIZ(':');
        }
        LIZ(str2);
        this.LJII = true;
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final XmlSerializer text(String str) {
        if (this.LJII) {
            LIZ(">");
            this.LJII = false;
        }
        LIZIZ(str);
        return this;
    }

    @Override // org.xmlpull.v1.XmlSerializer
    public final XmlSerializer text(char[] cArr, int i2, int i3) {
        String str;
        if (this.LJII) {
            LIZ(">");
            this.LJII = false;
        }
        String[] strArr = LIZ;
        char length = (char) strArr.length;
        int i4 = i3 + i2;
        int i5 = i2;
        while (i2 < i4) {
            char c = cArr[i2];
            if (c < length && (str = strArr[c]) != null) {
                if (i5 < i2) {
                    LIZ(cArr, i5, i2 - i5);
                }
                i5 = i2 + 1;
                LIZ(str);
            }
            i2++;
        }
        if (i5 < i2) {
            LIZ(cArr, i5, i2 - i5);
        }
        return this;
    }
}