package com.ifpdos.udi.sdk.binderhttpd;

import j.b0;
import j.c0;
import j.d;
import j.f;
import j.h;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;

/* JADX INFO: loaded from: classes.dex */
public class Sink implements f {
    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;
    }

    @Override // j.f
    public d buffer() {
        return null;
    }

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

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

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

    @Override // j.f, j.z, java.io.Flushable
    public void flush() throws IOException {
    }

    @Override // j.f
    public abstract /* synthetic */ d getBuffer();

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

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

    public OutputStream outputStream() {
        return null;
    }

    @Override // j.z
    public c0 timeout() {
        return null;
    }

    @Override // j.f
    public f write(h hVar) throws IOException {
        return write(hVar.k());
    }

    public abstract /* synthetic */ f write(h hVar, int i2, int i3) throws IOException;

    @Override // j.f
    public long writeAll(b0 b0Var) throws IOException {
        throw new IOException("not support writeAll");
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public f write(b0 b0Var, long j2) throws IOException {
        throw new IOException("not support write Source");
    }

    @Override // j.z
    public void write(d dVar, 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;
    }
}
