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.Buffer;
import okio.BufferedSink;
import okio.ByteString;
import okio.Source;
import okio.Timeout;

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

    @Override // okio.BufferedSink
    /* JADX INFO: renamed from: buffer */
    public Buffer getBufferField() {
        return null;
    }

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

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

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

    @Override // okio.BufferedSink
    public OutputStream outputStream() {
        return null;
    }

    @Override // okio.Sink
    /* JADX INFO: renamed from: timeout */
    public Timeout getThis$0() {
        return null;
    }

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

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

    @Override // okio.BufferedSink
    public BufferedSink write(ByteString byteString) throws IOException {
        return write(byteString.toByteArray());
    }

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

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

    @Override // okio.BufferedSink
    public long writeAll(Source source) throws IOException {
        throw new IOException("not support writeAll");
    }

    @Override // okio.BufferedSink
    public BufferedSink write(Source source, long j) throws IOException {
        throw new IOException("not support write Source");
    }

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

    @Override // okio.BufferedSink
    public BufferedSink writeUtf8(String str, int i, int i2) throws IOException {
        return write(str.substring(i, i2).getBytes());
    }

    @Override // okio.BufferedSink
    public BufferedSink writeUtf8CodePoint(int i) throws IOException {
        throw new IOException("not support writeUtf8CodePoint");
    }

    @Override // okio.BufferedSink
    public BufferedSink writeString(String str, Charset charset) throws IOException {
        return write(str.getBytes());
    }

    @Override // okio.BufferedSink
    public BufferedSink writeString(String str, int i, int i2, Charset charset) throws IOException {
        return write(str.substring(i, i2).getBytes());
    }

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

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

    @Override // okio.BufferedSink
    public BufferedSink writeShortLe(int i) throws IOException {
        throw new IOException("not support writeShortLe");
    }

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

    @Override // okio.BufferedSink
    public BufferedSink writeIntLe(int i) throws IOException {
        throw new IOException("not support writeIntLe");
    }

    @Override // okio.BufferedSink
    public BufferedSink writeLong(long j) throws IOException {
        throw new IOException("not support writeLong");
    }

    @Override // okio.BufferedSink
    public BufferedSink writeLongLe(long j) throws IOException {
        throw new IOException("not support writeLongLe");
    }

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

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

    @Override // okio.Sink
    public void write(Buffer buffer, long j) throws IOException {
        throw new IOException("not support write source byteCount");
    }

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

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

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