package com.ifpdos.udi.sdk.binderhttpd;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import okio.C0688f;
import okio.E;
import okio.F;
import okio.g;
import okio.i;

/* JADX INFO: loaded from: classes.dex */
public class Sink implements g {
    private byte[] mData = new byte[0];

    private byte[] addData(byte[] bArr, int i2, int i3) {
        byte[] bArr2 = this.mData;
        if (bArr2 == null) {
            return (byte[]) bArr.clone();
        }
        if (bArr == null) {
            return bArr2;
        }
        byte[] bArr3 = new byte[bArr2.length + i3];
        System.arraycopy(bArr2, 0, bArr3, 0, bArr2.length);
        System.arraycopy(bArr, i2, bArr3, this.mData.length, i3);
        return bArr3;
    }

    public C0688f buffer() {
        return null;
    }

    @Override // okio.C, java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel
    public void close() throws IOException {
    }

    @Override // okio.g
    public g emit() throws IOException {
        throw new IOException("not support emit");
    }

    @Override // okio.g
    public g emitCompleteSegments() throws IOException {
        throw new IOException("not support emitCompleteSegments");
    }

    @Override // okio.g, okio.C, java.io.Flushable
    public void flush() throws IOException {
    }

    @Override // okio.g
    public abstract /* synthetic */ C0688f getBuffer();

    public byte[] getData() {
        return this.mData;
    }

    @Override // java.nio.channels.Channel
    public boolean isOpen() {
        return true;
    }

    public OutputStream outputStream() {
        return null;
    }

    @Override // okio.C
    public F timeout() {
        return null;
    }

    @Override // okio.g
    public g write(i iVar) throws IOException {
        return write(iVar.v());
    }

    public abstract /* synthetic */ g write(i iVar, int i2, int i3) throws IOException;

    @Override // okio.g
    public long writeAll(E e2) throws IOException {
        throw new IOException("not support writeAll");
    }

    @Override // okio.g
    public g writeByte(int i2) throws IOException {
        throw new IOException("not support writeByte");
    }

    @Override // okio.g
    public g writeDecimalLong(long j2) throws IOException {
        throw new IOException("not support writeDecimalLong");
    }

    @Override // okio.g
    public g writeHexadecimalUnsignedLong(long j2) throws IOException {
        throw new IOException("not support writeHexadecimalUnsignedLong");
    }

    @Override // okio.g
    public g writeInt(int i2) throws IOException {
        throw new IOException("not support writeInt");
    }

    public g writeIntLe(int i2) throws IOException {
        throw new IOException("not support writeIntLe");
    }

    public g writeLong(long j2) throws IOException {
        throw new IOException("not support writeLong");
    }

    public g writeLongLe(long j2) throws IOException {
        throw new IOException("not support writeLongLe");
    }

    @Override // okio.g
    public g writeShort(int i2) throws IOException {
        throw new IOException("not support writeShort");
    }

    public g writeShortLe(int i2) throws IOException {
        throw new IOException("not support writeShortLe");
    }

    public g writeString(String str, Charset charset) throws IOException {
        return write(str.getBytes());
    }

    @Override // okio.g
    public g writeUtf8(String str) throws IOException {
        return write(str.getBytes());
    }

    public g writeUtf8CodePoint(int i2) throws IOException {
        throw new IOException("not support writeUtf8CodePoint");
    }

    @Override // okio.g
    public g write(byte[] bArr) throws IOException {
        this.mData = addData(bArr, 0, bArr.length);
        return this;
    }

    public g writeString(String str, int i2, int i3, Charset charset) throws IOException {
        return write(str.substring(i2, i3).getBytes());
    }

    public g writeUtf8(String str, int i2, int i3) throws IOException {
        return write(str.substring(i2, i3).getBytes());
    }

    @Override // okio.g
    public g write(byte[] bArr, int i2, int i3) throws IOException {
        this.mData = addData(bArr, i2, i3);
        return this;
    }

    public g write(E e2, long j2) throws IOException {
        throw new IOException("not support write Source");
    }

    @Override // okio.C
    public void write(C0688f c0688f, long j2) throws IOException {
        throw new IOException("not support write source byteCount");
    }

    @Override // java.nio.channels.WritableByteChannel
    public int write(ByteBuffer byteBuffer) throws IOException {
        byte[] bArrArray = byteBuffer.array();
        write(bArrArray);
        return bArrArray.length;
    }
}
