package com.lynx.react.bridge;

import X.C0627KBe;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.lynx.tasm.LynxEnv;
import java.nio.ByteBuffer;

public final class PiperData {
    public long LIZ;
    public ByteBuffer LIZIZ;
    public C0627KBe LIZJ = C0627KBe.Empty;

    static {
        Covode.recordClassIndex(46323);
    }

    public static native long nativeParseStringData(String str);

    public static native void nativeReleaseData(long j);

    public final ByteBuffer getBuffer() {
        return this.LIZIZ;
    }

    public final long getNativePtr() {
        return this.LIZ;
    }

    public final int getDataType() {
        return this.LIZJ.ordinal();
    }

    public final int getBufferPosition() {
        ByteBuffer byteBuffer = this.LIZIZ;
        if (byteBuffer == null) {
            return 0;
        }
        return byteBuffer.position();
    }

    public final void finalize() {
        MethodCollector.i(5161);
        super.finalize();
        if (LynxEnv.LIZJ().LJII()) {
            long j = this.LIZ;
            if (j != 0) {
                nativeReleaseData(j);
                this.LIZ = 0;
            }
        }
        MethodCollector.o(5161);
    }
}
