// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

import java.io.*;
import sign.signlink;

public class Class23
{

    public Class23(RandomAccessFile randomaccessfile, int i, RandomAccessFile randomaccessfile1, byte byte0, int j)
    {
        anInt355 = 65000;
        anInt354 = j;
        if(byte0 != -101)
        {
            for(int k = 1; k > 0; k++);
        }
        aRandomAccessFile352 = randomaccessfile;
        aRandomAccessFile353 = randomaccessfile1;
        anInt355 = i;
    }

    public synchronized byte[] method284(int i, byte byte0)
    {
        if(byte0 != 59)
            throw new NullPointerException();
        try
        {
            method287(true, i * 6, aRandomAccessFile353);
            int l;
            for(int j = 0; j < 6; j += l)
            {
                l = aRandomAccessFile353.read(aByteArray351, j, 6 - j);
                if(l == -1)
                    return null;
            }

            int i1 = ((aByteArray351[0] & 0xff) << 16) + ((aByteArray351[1] & 0xff) << 8) + (aByteArray351[2] & 0xff);
            int j1 = ((aByteArray351[3] & 0xff) << 16) + ((aByteArray351[4] & 0xff) << 8) + (aByteArray351[5] & 0xff);
            if(i1 < 0 || i1 > anInt355)
                return null;
            if(j1 <= 0 || (long)j1 > aRandomAccessFile352.length() / 520L)
                return null;
            byte abyte0[] = new byte[i1];
            int k1 = 0;
            for(int l1 = 0; k1 < i1; l1++)
            {
                if(j1 == 0)
                    return null;
                method287(true, j1 * 520, aRandomAccessFile352);
                int k = 0;
                int i2 = i1 - k1;
                if(i2 > 512)
                    i2 = 512;
                int j2;
                for(; k < i2 + 8; k += j2)
                {
                    j2 = aRandomAccessFile352.read(aByteArray351, k, (i2 + 8) - k);
                    if(j2 == -1)
                        return null;
                }

                int k2 = ((aByteArray351[0] & 0xff) << 8) + (aByteArray351[1] & 0xff);
                int l2 = ((aByteArray351[2] & 0xff) << 8) + (aByteArray351[3] & 0xff);
                int i3 = ((aByteArray351[4] & 0xff) << 16) + ((aByteArray351[5] & 0xff) << 8) + (aByteArray351[6] & 0xff);
                int j3 = aByteArray351[7] & 0xff;
                if(k2 != i || l2 != l1 || j3 != anInt354)
                    return null;
                if(i3 < 0 || (long)i3 > aRandomAccessFile352.length() / 520L)
                    return null;
                for(int k3 = 0; k3 < i2; k3++)
                    abyte0[k1++] = aByteArray351[k3 + 8];

                j1 = i3;
            }

            return abyte0;
        }
        catch(IOException _ex)
        {
            return null;
        }
    }

    public synchronized boolean method285(byte abyte0[], int i, boolean flag, int j)
    {
        if(!flag)
            throw new NullPointerException();
        boolean flag1 = method286(true, 0, i, abyte0, j);
        if(!flag1)
            flag1 = method286(false, 0, i, abyte0, j);
        return flag1;
    }

    public synchronized boolean method286(boolean flag, int i, int j, byte abyte0[], int k)
    {
        if(i != 0)
        {
            for(int l = 1; l > 0; l++);
        }
        try
        {
            int i1;
            if(flag)
            {
                method287(true, j * 6, aRandomAccessFile353);
                int l1;
                for(int j1 = 0; j1 < 6; j1 += l1)
                {
                    l1 = aRandomAccessFile353.read(aByteArray351, j1, 6 - j1);
                    if(l1 == -1)
                        return false;
                }

                i1 = ((aByteArray351[3] & 0xff) << 16) + ((aByteArray351[4] & 0xff) << 8) + (aByteArray351[5] & 0xff);
                if(i1 <= 0 || (long)i1 > aRandomAccessFile352.length() / 520L)
                    return false;
            } else
            {
                i1 = (int)((aRandomAccessFile352.length() + 519L) / 520L);
                if(i1 == 0)
                    i1 = 1;
            }
            aByteArray351[0] = (byte)(k >> 16);
            aByteArray351[1] = (byte)(k >> 8);
            aByteArray351[2] = (byte)k;
            aByteArray351[3] = (byte)(i1 >> 16);
            aByteArray351[4] = (byte)(i1 >> 8);
            aByteArray351[5] = (byte)i1;
            method287(true, j * 6, aRandomAccessFile353);
            aRandomAccessFile353.write(aByteArray351, 0, 6);
            int k1 = 0;
            for(int i2 = 0; k1 < k; i2++)
            {
                int j2 = 0;
                if(flag)
                {
                    method287(true, i1 * 520, aRandomAccessFile352);
                    int k2;
                    int i3;
                    for(k2 = 0; k2 < 8; k2 += i3)
                    {
                        i3 = aRandomAccessFile352.read(aByteArray351, k2, 8 - k2);
                        if(i3 == -1)
                            break;
                    }

                    if(k2 == 8)
                    {
                        int j3 = ((aByteArray351[0] & 0xff) << 8) + (aByteArray351[1] & 0xff);
                        int k3 = ((aByteArray351[2] & 0xff) << 8) + (aByteArray351[3] & 0xff);
                        j2 = ((aByteArray351[4] & 0xff) << 16) + ((aByteArray351[5] & 0xff) << 8) + (aByteArray351[6] & 0xff);
                        int l3 = aByteArray351[7] & 0xff;
                        if(j3 != j || k3 != i2 || l3 != anInt354)
                            return false;
                        if(j2 < 0 || (long)j2 > aRandomAccessFile352.length() / 520L)
                            return false;
                    }
                }
                if(j2 == 0)
                {
                    flag = false;
                    j2 = (int)((aRandomAccessFile352.length() + 519L) / 520L);
                    if(j2 == 0)
                        j2++;
                    if(j2 == i1)
                        j2++;
                }
                if(k - k1 <= 512)
                    j2 = 0;
                aByteArray351[0] = (byte)(j >> 8);
                aByteArray351[1] = (byte)j;
                aByteArray351[2] = (byte)(i2 >> 8);
                aByteArray351[3] = (byte)i2;
                aByteArray351[4] = (byte)(j2 >> 16);
                aByteArray351[5] = (byte)(j2 >> 8);
                aByteArray351[6] = (byte)j2;
                aByteArray351[7] = (byte)anInt354;
                method287(true, i1 * 520, aRandomAccessFile352);
                aRandomAccessFile352.write(aByteArray351, 0, 8);
                int l2 = k - k1;
                if(l2 > 512)
                    l2 = 512;
                aRandomAccessFile352.write(abyte0, k1, l2);
                k1 += l2;
                i1 = j2;
            }

            return true;
        }
        catch(IOException _ex)
        {
            return false;
        }
    }

    public synchronized void method287(boolean flag, int i, RandomAccessFile randomaccessfile)
        throws IOException
    {
        if(i < 0 || i > 0x3c00000)
        {
            System.out.println("Badseek - pos:" + i + " len:" + randomaccessfile.length());
            i = 0x3c00000;
            try
            {
                Thread.sleep(1000L);
            }
            catch(Exception _ex) { }
        }
        randomaccessfile.seek(i);
        if(flag);
    }

    public static byte aByteArray351[] = new byte[520];
    public RandomAccessFile aRandomAccessFile352;
    public RandomAccessFile aRandomAccessFile353;
    public int anInt354;
    public int anInt355;

}
