package io.flutter.plugins.webviewflutter;

import io.flutter.plugin.common.StandardMessageCodec;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import r4.AbstractC0983h;

/* JADX INFO: loaded from: classes.dex */
class AndroidWebkitLibraryPigeonCodec extends StandardMessageCodec {
    @Override // io.flutter.plugin.common.StandardMessageCodec
    public Object readValueOfType(byte b2, ByteBuffer byteBuffer) {
        AbstractC0983h.e("buffer", byteBuffer);
        if (b2 == -127) {
            Long l5 = (Long) readValue(byteBuffer);
            if (l5 == null) {
                return null;
            }
            return FileChooserMode.Companion.ofRaw((int) l5.longValue());
        }
        if (b2 == -126) {
            Long l6 = (Long) readValue(byteBuffer);
            if (l6 == null) {
                return null;
            }
            return ConsoleMessageLevel.Companion.ofRaw((int) l6.longValue());
        }
        if (b2 == -125) {
            Long l7 = (Long) readValue(byteBuffer);
            if (l7 == null) {
                return null;
            }
            return OverScrollMode.Companion.ofRaw((int) l7.longValue());
        }
        if (b2 == -124) {
            Long l8 = (Long) readValue(byteBuffer);
            if (l8 == null) {
                return null;
            }
            return SslErrorType.Companion.ofRaw((int) l8.longValue());
        }
        if (b2 != -123) {
            return super.readValueOfType(b2, byteBuffer);
        }
        Long l9 = (Long) readValue(byteBuffer);
        if (l9 == null) {
            return null;
        }
        return MixedContentMode.Companion.ofRaw((int) l9.longValue());
    }

    @Override // io.flutter.plugin.common.StandardMessageCodec
    public void writeValue(ByteArrayOutputStream byteArrayOutputStream, Object obj) {
        AbstractC0983h.e("stream", byteArrayOutputStream);
        if (obj instanceof FileChooserMode) {
            byteArrayOutputStream.write(129);
            writeValue(byteArrayOutputStream, Long.valueOf(((FileChooserMode) obj).getRaw()));
            return;
        }
        if (obj instanceof ConsoleMessageLevel) {
            byteArrayOutputStream.write(130);
            writeValue(byteArrayOutputStream, Long.valueOf(((ConsoleMessageLevel) obj).getRaw()));
            return;
        }
        if (obj instanceof OverScrollMode) {
            byteArrayOutputStream.write(131);
            writeValue(byteArrayOutputStream, Long.valueOf(((OverScrollMode) obj).getRaw()));
        } else if (obj instanceof SslErrorType) {
            byteArrayOutputStream.write(132);
            writeValue(byteArrayOutputStream, Long.valueOf(((SslErrorType) obj).getRaw()));
        } else if (!(obj instanceof MixedContentMode)) {
            super.writeValue(byteArrayOutputStream, obj);
        } else {
            byteArrayOutputStream.write(133);
            writeValue(byteArrayOutputStream, Long.valueOf(((MixedContentMode) obj).getRaw()));
        }
    }
}
