X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f

以下内容为反编译后的 C7114c.java 源代码,内容仅作参考


package o6;

import c8.HV.eTehUBU;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import t4.KPI.Rzzbdfw;

public class C7114c extends AbstractC7113b {

    private int f52427P;

    private final q f52428Q;

    private int f52429R;

    private boolean f52430S;

    private boolean f52431T;

    private boolean f52432U;

    class a extends OutputStream {

        private final q f52433E;

        final byte[] f52434F = new byte[1];

        final long f52435G;

        final byte[] f52436H;

        private boolean f52438a;

        private int f52439b;

        private int f52440c;

        private int f52441d;

        private long f52442e;

        a(long j9, byte[] bArr, b bVar) {
            this.f52435G = j9;
            this.f52436H = bArr;
            this.f52442e = j9;
            this.f52433E = new q(C7114c.this.k());
        }

        private void b(byte[] bArr, int i9, int i10) {
            if (!this.f52438a) {
                this.f52439b = C7114c.this.f52427P;
                this.f52438a = true;
            }
            synchronized (C7114c.this.f52428Q) {
                while (i10 > 0) {
                    try {
                        int d9 = d(bArr, i9, i10);
                        this.f52441d++;
                        this.f52442e += d9;
                        i9 += d9;
                        i10 -= d9;
                        if (C7114c.this.f52427P - 1 != this.f52439b && C7114c.this.h().b().available() < 1024) {
                        }
                        while (C7114c.this.h().b().available() > 0) {
                            int i11 = C7114c.this.W(-1).f52453c;
                            if (i11 < this.f52439b || i11 > C7114c.this.f52427P - 1) {
                                throw new g("");
                            }
                            this.f52440c++;
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            }
        }

        private int d(byte[] bArr, int i9, int i10) {
            C7114c.this.U();
            q qVar = this.f52433E;
            C7114c.this.B(qVar, (byte) 6).E(C7114c.O(C7114c.this)).B(this.f52436H).F(this.f52442e);
            int length = (qVar.a().length - qVar.v()) - 88;
            if (i10 > length) {
                i10 = length;
            }
            qVar.C(bArr, i9, i10);
            C7114c.this.z0(qVar);
            return i10;
        }

        @Override
        public void close() {
            synchronized (C7114c.this.f52428Q) {
                flush();
                C7114c.this.p0(this.f52436H);
            }
        }

        @Override
        public void flush() {
            synchronized (C7114c.this.f52428Q) {
                while (this.f52441d > this.f52440c) {
                    try {
                        try {
                            C7114c.this.W(-1);
                            this.f52440c++;
                        } catch (IOException e9) {
                            throw e9;
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            }
        }

        @Override
        public void write(int i9) {
            byte[] bArr = this.f52434F;
            bArr[0] = (byte) i9;
            write(bArr, 0, 1);
        }

        @Override
        public void write(byte[] bArr, int i9, int i10) {
            b(bArr, i9, i10);
        }
    }

    public interface b {
    }

    protected class C0798c extends InputStream {

        int f52443E;

        long f52444F;

        final String f52446a;

        private final byte[] f52447b;

        boolean f52448c;

        private final byte[] f52449d = new byte[1];

        byte[] f52450e;

        C0798c(String str, long j9) {
            this.f52446a = str;
            this.f52444F = j9;
            synchronized (C7114c.this.f52428Q) {
                try {
                    int i9 = C7114c.this.f52427P;
                    try {
                        C7114c.this.r0(str, 1);
                        C7114c.this.Y((byte) 102, i9);
                        this.f52447b = C7114c.this.f52428Q.i();
                    } catch (IOException e9) {
                        this.f52448c = true;
                        throw e9;
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }

        @Override
        public void close() {
            if (!this.f52448c) {
                synchronized (C7114c.this.f52428Q) {
                    try {
                        this.f52448c = true;
                        C7114c.this.p0(this.f52447b);
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            }
        }

        @Override
        public int read() {
            if (read(this.f52449d, 0, 1) == -1) {
                return -1;
            }
            return this.f52449d[0] & 255;
        }

        @Override
        public int read(byte[] bArr, int i9, int i10) {
            if (this.f52448c) {
                return -1;
            }
            if (!C7114c.this.m()) {
                throw new IOException("SFTP is closed");
            }
            int i11 = this.f52443E;
            if (i11 > 0) {
                int min = Math.min(i11, i10);
                System.arraycopy(this.f52450e, 0, bArr, i9, min);
                int i12 = this.f52443E - min;
                this.f52443E = i12;
                if (i12 > 0) {
                    byte[] bArr2 = this.f52450e;
                    System.arraycopy(bArr2, min, bArr2, 0, i12);
                }
                return min;
            }
            synchronized (C7114c.this.f52428Q) {
                try {
                    int i13 = C7114c.this.f52427P;
                    int length = C7114c.this.f52428Q.a().length - 13;
                    if (C7114c.this.f52429R == 0) {
                        length = 1024;
                    }
                    C7114c.this.f0((byte) 5).B(this.f52447b).F(this.f52444F).E(length);
                    C7114c c7114c = C7114c.this;
                    c7114c.z0(c7114c.f52428Q);
                    C7114c c7114c2 = C7114c.this;
                    d dVar = new d(c7114c2.f52428Q);
                    if (i13 != dVar.f52453c) {
                        throw new g("read: invalid request id " + dVar.f52453c);
                    }
                    int i14 = dVar.f52452b;
                    if (i14 == 101) {
                        C7114c.this.Z(dVar.f52451a);
                        if (C7114c.this.f52428Q.j() != 1) {
                            throw new IOException("error");
                        }
                        close();
                        return -1;
                    }
                    if (i14 != 103) {
                        throw new IOException("error");
                    }
                    C7114c.this.f52428Q.n();
                    C7114c.this.a0(0, 4);
                    int j9 = C7114c.this.f52428Q.j();
                    this.f52444F += j9;
                    if (j9 == 0) {
                        return 0;
                    }
                    try {
                        int min2 = Math.min(j9, i10);
                        C7114c.h0(C7114c.this.h().b(), bArr, i9, min2);
                        if (min2 < 0) {
                            return -1;
                        }
                        int i15 = j9 - min2;
                        this.f52443E = i15;
                        if (i15 > 0) {
                            byte[] bArr3 = this.f52450e;
                            if (bArr3 != null) {
                                if (bArr3.length < i15) {
                                }
                                C7114c.h0(C7114c.this.h().b(), this.f52450e, 0, this.f52443E);
                            }
                            this.f52450e = new byte[Math.max(i15, 1024)];
                            C7114c.h0(C7114c.this.h().b(), this.f52450e, 0, this.f52443E);
                        }
                        int i16 = (dVar.f52451a - 4) - j9;
                        if (i16 > 0) {
                            C7114c.w0(C7114c.this.h().b(), i16);
                        }
                        return min2;
                    } catch (IOException e9) {
                        e9.printStackTrace();
                        throw e9;
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
    }

    public class d {

        final int f52451a;

        final int f52452b;

        final int f52453c;

        d(C7121j c7121j) {
            try {
                c7121j.n();
                C7114c.this.a0(0, 9);
                this.f52451a = c7121j.g() - 5;
                this.f52452b = c7121j.h();
                this.f52453c = c7121j.j();
            } catch (InterruptedIOException e9) {
                throw e9;
            } catch (IOException e10) {
                C7114c.this.d();
                throw e10;
            }
        }
    }

    public static class e {

        public final String f52455a;

        final String f52456b;

        public final f f52457c;

        e(String str, String str2, f fVar) {
            this.f52455a = str;
            this.f52456b = str2;
            this.f52457c = fVar;
        }

        public String toString() {
            return this.f52456b;
        }
    }

    public static class f {

        int f52458a;

        public long f52459b;

        int f52460c;

        int f52461d;

        public int f52462e;

        int f52463f;

        public int f52464g;

        String[] f52465h;

        f(C7121j c7121j) {
            int j9;
            int j10 = c7121j.j();
            this.f52458a = j10;
            if ((j10 & 1) != 0) {
                this.f52459b = c7121j.k();
            }
            if ((this.f52458a & 2) != 0) {
                this.f52460c = c7121j.j();
                this.f52461d = c7121j.j();
            }
            if ((this.f52458a & 4) != 0) {
                this.f52462e = c7121j.j();
            }
            if ((this.f52458a & 8) != 0) {
                this.f52463f = c7121j.j();
                this.f52464g = c7121j.j();
            }
            if ((this.f52458a & Integer.MIN_VALUE) == 0 || (j9 = c7121j.j()) <= 0) {
                return;
            }
            this.f52465h = new String[j9 * 2];
            for (int i9 = 0; i9 < j9; i9++) {
                int i10 = i9 * 2;
                this.f52465h[i10] = c7121j.m();
                this.f52465h[i10 + 1] = c7121j.m();
            }
        }

        private boolean e(int i9) {
            return (this.f52458a & 4) != 0 && ((this.f52462e >> 12) & 15) == i9;
        }

        void a() {
            this.f52458a = 0;
        }

        public void b() {
            this.f52458a &= -9;
            this.f52464g = 0;
            this.f52463f = 0;
        }

        public boolean c() {
            return e(4);
        }

        public boolean d() {
            return e(10);
        }

        void f(int i9) {
            this.f52458a |= 4;
            this.f52462e = (i9 & 4095) | (this.f52462e & (-4096));
        }

        public void g(long j9) {
            if (j9 == -1) {
                this.f52459b = 0L;
                this.f52458a &= -2;
            } else {
                this.f52458a |= 1;
                this.f52459b = j9;
            }
        }

        public void h(int i9, int i10) {
            this.f52458a |= 8;
            this.f52463f = i9;
            this.f52464g = i10;
        }

        void i(q qVar) {
            int length;
            qVar.E(this.f52458a);
            if ((this.f52458a & 1) != 0) {
                qVar.F(this.f52459b);
            }
            if ((this.f52458a & 2) != 0) {
                qVar.E(this.f52460c).E(this.f52461d);
            }
            if ((this.f52458a & 4) != 0) {
                qVar.E(this.f52462e);
            }
            if ((this.f52458a & 8) != 0) {
                qVar.E(this.f52463f).E(this.f52464g);
            }
            if ((this.f52458a & Integer.MIN_VALUE) == 0 || (length = this.f52465h.length / 2) <= 0) {
                return;
            }
            for (int i9 = 0; i9 < length; i9++) {
                int i10 = i9 * 2;
                qVar.J(this.f52465h[i10]).J(this.f52465h[i10 + 1]);
            }
        }
    }

    public static class g extends IOException {
        g(int i9) {
            super(a(i9));
        }

        g(String str) {
            super(str);
        }

        private static String a(int i9) {
            if (i9 == 2) {
                return "No such file";
            }
            int i10 = 0 << 3;
            if (i9 == 3) {
                return "Permission denied";
            }
            if (i9 == 4) {
                return "Failure";
            }
            if (i9 == 5) {
                return "Protocol error";
            }
            if (i9 == 8) {
                return "Unsupported operation";
            }
            return "Error #" + i9;
        }
    }

    public static class h extends j {

        private boolean f52466H;

        h(k kVar, int i9) {
            super(kVar, i9);
        }

        void i() {
            this.f52466H = true;
        }

        synchronized void j(byte[] bArr, int i9, int i10) {
            while (i10 > 0) {
                try {
                    if (this.f52471a == null || this.f52466H) {
                        throw new IOException("Pipe is closed");
                    }
                    while (this.f52471a != null && this.f52473c == this.f52472b) {
                        try {
                            notifyAll();
                            wait(1000L);
                        } catch (InterruptedException unused) {
                            C7114c.y0();
                        }
                    }
                    byte[] bArr2 = this.f52471a;
                    if (bArr2 == null) {
                        throw new IOException("Pipe is closed");
                    }
                    if (this.f52472b == -1) {
                        this.f52472b = 0;
                    }
                    int i11 = this.f52472b;
                    int i12 = this.f52473c;
                    int min = Math.min(i10, i11 >= i12 ? bArr2.length - i11 : i12 - i11);
                    System.arraycopy(bArr, i9, this.f52471a, this.f52472b, min);
                    int i13 = this.f52472b + min;
                    this.f52472b = i13;
                    i9 += min;
                    i10 -= min;
                    if (i13 == this.f52471a.length) {
                        this.f52472b = 0;
                    }
                    notifyAll();
                } catch (Throwable th) {
                    throw th;
                }
            }
        }

        synchronized void k() {
            byte[] bArr;
            try {
                if (available() == 0 && (bArr = this.f52471a) != null) {
                    this.f52473c = 0;
                    int i9 = 0 >> 1;
                    this.f52472b = 1;
                    bArr[0] = 124;
                    read();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    private static class i extends k {

        private h f52467b;

        private i() {
            super(null);
        }

        i(a aVar) {
            this();
        }

        @Override
        public void b(j jVar) {
            super.b(jVar);
            this.f52467b = (h) jVar;
        }

        @Override
        public void close() {
            super.close();
            this.f52467b.i();
        }

        @Override
        public void write(byte[] bArr, int i9, int i10) {
            this.f52467b.j(bArr, i9, i10);
        }
    }

    public static abstract class j extends InputStream {

        private Thread f52468E;

        private boolean f52469F;

        protected byte[] f52471a;

        protected int f52473c;

        boolean f52474d;

        private Thread f52475e;

        protected int f52472b = -1;

        private final byte[] f52470G = new byte[1];

        j(k kVar, int i9) {
            if (i9 > 0) {
                this.f52471a = new byte[i9];
                b(kVar);
            } else {
                throw new IllegalArgumentException("pipe size " + i9 + " too small");
            }
        }

        @Override
        public synchronized int available() {
            int i9;
            try {
                byte[] bArr = this.f52471a;
                if (bArr != null && (i9 = this.f52472b) != -1) {
                    int i10 = this.f52473c;
                    return i9 <= i10 ? (bArr.length - i10) + i9 : i9 - i10;
                }
                return 0;
            } catch (Throwable th) {
                throw th;
            }
        }

        void b(k kVar) {
            kVar.b(this);
        }

        @Override
        public synchronized void close() {
            this.f52471a = null;
            notifyAll();
        }

        synchronized void d() {
            try {
                this.f52469F = true;
                notifyAll();
            } catch (Throwable th) {
                throw th;
            }
        }

        synchronized void f() {
            try {
                if (this.f52474d) {
                    throw new IOException(eTehUBU.zdMP);
                }
                if (this.f52471a == null) {
                    this.f52471a = new byte[1024];
                }
                this.f52474d = true;
            } catch (Throwable th) {
                throw th;
            }
        }

        protected synchronized void h(int i9) {
            try {
                if (this.f52471a == null || this.f52469F) {
                    throw new IOException("Pipe is closed");
                }
                this.f52468E = Thread.currentThread();
                while (this.f52471a != null && this.f52473c == this.f52472b) {
                    try {
                        Thread thread = this.f52475e;
                        if (thread != null && !thread.isAlive()) {
                            throw new IOException("Pipe broken");
                        }
                        notifyAll();
                        wait(1000L);
                    } catch (InterruptedException unused) {
                        C7114c.y0();
                    }
                }
                if (this.f52471a == null) {
                    throw new IOException("Pipe is closed");
                }
                if (this.f52472b == -1) {
                    this.f52472b = 0;
                }
                Thread thread2 = this.f52475e;
                if (thread2 != null && !thread2.isAlive()) {
                    throw new IOException("Pipe broken");
                }
                byte[] bArr = this.f52471a;
                int i10 = this.f52472b;
                int i11 = i10 + 1;
                this.f52472b = i11;
                bArr[i10] = (byte) i9;
                if (i11 == bArr.length) {
                    this.f52472b = 0;
                }
                notifyAll();
            } catch (Throwable th) {
                throw th;
            }
        }

        @Override
        public int read() {
            if (read(this.f52470G, 0, 1) == -1) {
                return -1;
            }
            return this.f52470G[0] & 255;
        }

        @Override
        public synchronized int read(byte[] bArr, int i9, int i10) {
            int i11;
            int i12;
            Thread thread;
            if (i10 == 0) {
                return 0;
            }
            try {
                if (!this.f52474d) {
                    throw new IOException("Not connected");
                }
                byte[] bArr2 = this.f52471a;
                if (bArr2 == null) {
                    throw new IOException("InputStream is closed");
                }
                this.f52475e = Thread.currentThread();
                int i13 = 3;
                while (true) {
                    int i14 = this.f52472b;
                    if (i14 != -1) {
                        if (this.f52471a == null) {
                            return -1;
                        }
                        int i15 = this.f52473c;
                        if (i15 >= i14) {
                            i11 = Math.min(bArr2.length - i15, i10);
                            System.arraycopy(bArr2, this.f52473c, bArr, i9, i11);
                            int i16 = this.f52473c + i11;
                            this.f52473c = i16;
                            if (i16 == bArr2.length) {
                                this.f52473c = 0;
                            }
                            if (this.f52473c == this.f52472b) {
                                this.f52472b = -1;
                                this.f52473c = 0;
                            }
                        } else {
                            i11 = 0;
                        }
                        if (i11 < i10 && (i12 = this.f52472b) != -1) {
                            int min = Math.min(i10 - i11, i12 - this.f52473c);
                            System.arraycopy(bArr2, this.f52473c, bArr, i9 + i11, min);
                            int i17 = this.f52473c + min;
                            this.f52473c = i17;
                            if (i17 == this.f52472b) {
                                this.f52472b = -1;
                                this.f52473c = 0;
                            }
                            i11 += min;
                        }
                        notifyAll();
                        return i11;
                    }
                    if (this.f52469F) {
                        return -1;
                    }
                    int i18 = i13 - 1;
                    if (i13 <= 0 && (thread = this.f52468E) != null && !thread.isAlive()) {
                        throw new IOException("Pipe broken");
                    }
                    notifyAll();
                    try {
                        wait(1000L);
                    } catch (InterruptedException unused) {
                    }
                    i13 = i18;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public static class k extends OutputStream {

        private j f52476a;

        private k() {
        }

        k(a aVar) {
            this();
        }

        void b(j jVar) {
            if (jVar == null) {
                throw new NullPointerException("stream == null");
            }
            synchronized (jVar) {
                try {
                    if (this.f52476a != null) {
                        throw new IOException("Already connected");
                    }
                    if (jVar.f52474d) {
                        throw new IOException(Rzzbdfw.aXsUnQxK);
                    }
                    jVar.f();
                    this.f52476a = jVar;
                } catch (Throwable th) {
                    throw th;
                }
            }
        }

        @Override
        public void close() {
            j jVar = this.f52476a;
            if (jVar != null) {
                jVar.d();
                this.f52476a = null;
            }
        }

        @Override
        public void flush() {
            j jVar = this.f52476a;
            if (jVar == null) {
                return;
            }
            synchronized (jVar) {
                try {
                    jVar.notifyAll();
                } finally {
                }
            }
        }

        @Override
        public void write(int i9) {
            j jVar = this.f52476a;
            if (jVar == null) {
                throw new IOException("Pipe not connected");
            }
            jVar.h(i9);
        }
    }

    public C7114c(o oVar) {
        super(oVar, 32768, 2097152);
        this.f52427P = 1;
        this.f52429R = 3;
        this.f52428Q = new q(i());
        c("session");
    }

    public q B(q qVar, byte b9) {
        return qVar.P(94, j()).E(0).E(0).z(b9);
    }

    private String C(byte b9, String str) {
        String str2;
        synchronized (this.f52428Q) {
            try {
                int i9 = this.f52427P;
                s0(b9, str);
                Y((byte) 104, i9);
                int j9 = this.f52428Q.j();
                str2 = null;
                for (int i10 = 0; i10 < j9; i10++) {
                    str2 = this.f52428Q.m();
                    if (this.f52429R <= 3) {
                        this.f52428Q.m();
                    }
                    new f(this.f52428Q);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        return str2;
    }

    static int O(C7114c c7114c) {
        int i9 = c7114c.f52427P;
        c7114c.f52427P = i9 + 1;
        return i9;
    }

    public void U() {
    }

    private boolean V() {
        return this.f52429R >= 3;
    }

    public d W(int i9) {
        U();
        d Y8 = Y((byte) 101, i9);
        int j9 = this.f52428Q.j();
        if (j9 == 0) {
            return Y8;
        }
        throw new g(j9);
    }

    public d Y(byte b9, int i9) {
        U();
        d dVar = new d(this.f52428Q);
        Z(dVar.f52451a);
        if (i9 != -1 && i9 != dVar.f52453c) {
            String str = "Request ID mismatch, expecting  " + i9 + ", got " + dVar.f52453c;
            d();
            throw new g(str);
        }
        int i10 = dVar.f52452b;
        if (i10 == b9) {
            return dVar;
        }
        if (i10 == 101) {
            throw new g(this.f52428Q.j());
        }
        String str2 = "Expecting data type " + ((int) b9) + ", got " + dVar.f52452b + ", reqId=" + dVar.f52453c;
        d();
        throw new g(str2);
    }

    public void Z(int i9) {
        this.f52428Q.K();
        a0(0, i9);
        this.f52428Q.I(i9);
    }

    public void a0(int i9, int i10) {
        InputStream b9 = h().b();
        if (b9 == null) {
            throw new IOException("inputstream is closed");
        }
        while (i10 > 0) {
            int read = b9.read(this.f52428Q.a(), i9, i10);
            if (read <= 0) {
                throw new EOFException("inputstream is closed");
            }
            i9 += read;
            i10 -= read;
        }
    }

    public q f0(byte b9) {
        U();
        q B8 = B(this.f52428Q, b9);
        int i9 = this.f52427P;
        this.f52427P = i9 + 1;
        return B8.E(i9);
    }

    private q g0(byte b9, String str) {
        U();
        return f0(b9).J(str);
    }

    public static void h0(InputStream inputStream, byte[] bArr, int i9, int i10) {
        while (i10 > 0) {
            int read = inputStream.read(bArr, i9, i10);
            if (read < 0) {
                throw new EOFException();
            }
            i9 += read;
            i10 -= read;
        }
    }

    private void k0(byte b9, String str) {
        synchronized (this.f52428Q) {
            try {
                int i9 = this.f52427P;
                s0(b9, str);
                W(i9);
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    private void m0() {
        int i9 = 2 & 1;
        A(l("subsystem", true).J("sftp"), true);
    }

    public void p0(byte[] bArr) {
        int i9 = this.f52427P;
        q0((byte) 4, bArr);
        W(i9);
    }

    private void q0(byte b9, byte[] bArr) {
        U();
        f0(b9).B(bArr);
        z0(this.f52428Q);
    }

    public void r0(String str, int i9) {
        U();
        g0((byte) 3, str).E(i9).E(0);
        z0(this.f52428Q);
    }

    private void s0(byte b9, String str) {
        U();
        g0(b9, str);
        z0(this.f52428Q);
    }

    private void t0(byte b9, String str, String str2) {
        U();
        g0(b9, str).J(str2);
        z0(this.f52428Q);
    }

    private void u0(String str, String str2, String str3) {
        U();
        f0((byte) -56).J(str).J(str2).J(str3);
        z0(this.f52428Q);
    }

    public static void w0(InputStream inputStream, long j9) {
        while (j9 > 0) {
            long skip = inputStream.skip(j9);
            if (skip == 0) {
                skip = inputStream.skip(j9);
            }
            if (skip <= 0) {
                throw new EOFException();
            }
            j9 -= skip;
        }
    }

    public static void y0() {
        Thread.currentThread().interrupt();
        throw new InterruptedIOException();
    }

    public void z0(q qVar) {
        U();
        if (h().b() != null) {
            ((h) h().b()).k();
        }
        int v8 = qVar.v();
        qVar.L(10);
        int i9 = v8 - 14;
        qVar.E(i9).E(v8 - 18);
        qVar.L(v8);
        y(qVar, i9);
    }

    public void X(int i9, String str) {
        f x02 = x0(str);
        x02.a();
        x02.f(i9);
        v0(str, x02);
    }

    public InputStream b0(String str, long j9) {
        return new C0798c(str, j9);
    }

    public Collection c0(String str) {
        ArrayList arrayList;
        synchronized (this.f52428Q) {
            try {
                int i9 = this.f52427P;
                s0((byte) 11, str);
                Y((byte) 102, i9);
                byte[] i10 = this.f52428Q.i();
                arrayList = new ArrayList();
                while (true) {
                    q0((byte) 12, i10);
                    d dVar = new d(this.f52428Q);
                    int i11 = dVar.f52451a;
                    int i12 = dVar.f52452b;
                    if (i12 == 101) {
                        Z(i11);
                        int j9 = this.f52428Q.j();
                        if (j9 != 1) {
                            throw new g(j9);
                        }
                        p0(i10);
                    } else {
                        if (i12 != 104) {
                            throw new g("");
                        }
                        this.f52428Q.n();
                        a0(0, 4);
                        int i13 = i11 - 4;
                        int j10 = this.f52428Q.j();
                        this.f52428Q.K();
                        while (true) {
                            j10--;
                            if (j10 >= 0) {
                                if (i13 > 0) {
                                    this.f52428Q.N();
                                    int length = this.f52428Q.a().length > this.f52428Q.v() + i13 ? i13 : this.f52428Q.a().length - this.f52428Q.v();
                                    a0(this.f52428Q.v(), length);
                                    q qVar = this.f52428Q;
                                    qVar.L(qVar.v() + length);
                                    i13 -= length;
                                }
                                arrayList.add(new e(this.f52428Q.m(), this.f52429R <= 3 ? this.f52428Q.m() : null, new f(this.f52428Q)));
                            }
                        }
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        return arrayList;
    }

    public void d0(String str) {
        synchronized (this.f52428Q) {
            try {
                int i9 = this.f52427P;
                g0((byte) 14, str);
                this.f52428Q.E(0);
                z0(this.f52428Q);
                W(i9);
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public OutputStream e0(String str, int i9, long j9, b bVar) {
        a aVar;
        if (i9 == 1 || i9 == 2) {
            try {
                j9 += x0(str).f52459b;
            } catch (IOException unused) {
            }
        }
        long j10 = j9;
        int i10 = i9 == 0 ? 26 : 10;
        synchronized (this.f52428Q) {
            try {
                int i11 = this.f52427P;
                r0(str, i10);
                Y((byte) 102, i11);
                aVar = new a(j10, this.f52428Q.i(), bVar);
            } catch (Throwable th) {
                throw th;
            }
        }
        return aVar;
    }

    public String i0(String str) {
        if (V()) {
            return C((byte) 19, str);
        }
        throw new g("The remote sshd is too old to support symlink operation.");
    }

    public String j0(String str) {
        return C((byte) 16, str);
    }

    public void l0(String str, String str2) {
        if (this.f52429R < 2) {
            throw new g("The remote sshd is too old to support rename operation.");
        }
        synchronized (this.f52428Q) {
            try {
                int i9 = this.f52427P;
                if (this.f52430S) {
                    u0("posix-rename@openssh.com", str, str2);
                } else {
                    t0((byte) 18, str, str2);
                }
                W(i9);
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public void n0(String str) {
        k0((byte) 13, str);
    }

    public void o0(String str) {
        k0((byte) 15, str);
    }

    public synchronized void v0(String str, f fVar) {
        try {
            synchronized (this.f52428Q) {
                try {
                    int i9 = this.f52427P;
                    g0((byte) 9, str);
                    fVar.i(this.f52428Q);
                    z0(this.f52428Q);
                    W(i9);
                } finally {
                }
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override
    public void w() {
        d dVar;
        i iVar = new i(null);
        h().f(iVar);
        h().e(new h(iVar, k()));
        m0();
        synchronized (this.f52428Q) {
            B(this.f52428Q, (byte) 1).E(3);
            z0(this.f52428Q);
            dVar = new d(this.f52428Q);
        }
        int i9 = dVar.f52451a;
        if (i9 > 262144) {
            throw new g("Received message is too long: " + i9);
        }
        this.f52429R = dVar.f52453c;
        HashMap hashMap = new HashMap();
        if (i9 > 0) {
            Z(i9);
            while (i9 > 0) {
                byte[] i10 = this.f52428Q.i();
                int length = i9 - (i10.length + 4);
                byte[] i11 = this.f52428Q.i();
                i9 = length - (i11.length + 4);
                hashMap.put(new String(i10), new String(i11));
            }
        }
        if ("1".equals(hashMap.get("posix-rename@openssh.com"))) {
            this.f52430S = true;
        }
        if ("2".equals(hashMap.get("statvfs@openssh.com"))) {
            this.f52431T = true;
        }
        if ("1".equals(hashMap.get("hardlink@openssh.com"))) {
            this.f52432U = true;
        }
    }

    public f x0(String str) {
        f fVar;
        synchronized (this.f52428Q) {
            try {
                int i9 = this.f52427P;
                s0((byte) 17, str);
                Y((byte) 105, i9);
                fVar = new f(this.f52428Q);
            } catch (Throwable th) {
                throw th;
            }
        }
        return fVar;
    }
}