// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 12.08.2011 2:53:57
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 

import java.io.*;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.microedition.rms.*;

public final class m
{

    public m(String s)
    {
        b = s;
    }

    public m(String s, String s1)
    {
        b = a(s, s1);
    }

    public static String a(String s, String s1)
    {
        int i = Math.abs((s + s1).hashCode());
        return "a" + String.valueOf(i);
    }

    public static void a(String s, String s1)
    {
        try
        {
            RecordStore.deleteRecordStore(a(s, s1));
            return;
        }
        catch(Exception _ex)
        {
            return;
        }
    }

    private void b()
    {
        RecordStore recordstore = null;
        try
        {
            for(RecordEnumeration recordenumeration = (recordstore = RecordStore.openRecordStore(b, true)).enumerateRecords(null, null, false); recordenumeration.hasNextElement(); recordstore.deleteRecord(recordenumeration.nextRecordId()));
            recordstore = null;
        }
        catch(Exception _ex) { }
        try
        {
            recordstore.closeRecordStore();
            return;
        }
        catch(Exception _ex)
        {
            return;
        }
    }

    public final void a(String as[])
    {
        try
        {
            b();
            RecordStore recordstore = RecordStore.openRecordStore(b, true);
            ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
            DataOutputStream dataoutputstream;
            (dataoutputstream = new DataOutputStream(bytearrayoutputstream)).writeInt(as.length);
            for(int i = 0; i < as.length; i++)
                dataoutputstream.writeUTF(as[i]);

            byte abyte0[] = bytearrayoutputstream.toByteArray();
            recordstore.addRecord(abyte0, 0, abyte0.length);
            bytearrayoutputstream.close();
            recordstore.closeRecordStore();
            return;
        }
        catch(RecordStoreFullException _ex)
        {
            a_java_lang_String_static_fld = b;
        }
        catch(Exception _ex)
        {
            return;
        }
        a_java_lang_String_array1d_static_fld = as;
        y.h();
    }

    public final void a()
    {
        String s = null;
        long l = System.currentTimeMillis();
        int i = ae.a();
        for(int j = 0; j < i; j++)
        {
            String s2 = a(y.a, ae.a(j).a);
            try
            {
                RecordStore recordstore;
                long l1;
                if((l1 = (recordstore = RecordStore.openRecordStore(s2, false)).getLastModified()) < l)
                {
                    l = l1;
                    s = s2;
                }
                recordstore.closeRecordStore();
            }
            catch(RecordStoreNotFoundException _ex) { }
            catch(RecordStoreException _ex) { }
        }

        if(s != null)
            try
            {
                String s1 = b;
                RecordStore.deleteRecordStore(s);
                b = a_java_lang_String_static_fld;
                a(a_java_lang_String_array1d_static_fld);
                b = s1;
                return;
            }
            catch(RecordStoreException _ex) { }
    }

    public final String[] a()
    {
        String as[];
        RecordStore recordstore;
        RecordEnumeration recordenumeration = (recordstore = RecordStore.openRecordStore(b, false)).enumerateRecords(null, null, false);
        ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(recordenumeration.nextRecord());
        DataInputStream datainputstream;
        int i;
        as = new String[i = (datainputstream = new DataInputStream(bytearrayinputstream)).readInt()];
        for(int j = 0; j < i; j++)
            as[j] = datainputstream.readUTF();

        bytearrayinputstream.close();
        recordstore.closeRecordStore();
        return as;
        JVM INSTR pop ;
        return null;
    }

    public final void a(Hashtable hashtable)
    {
        try
        {
            String as[] = new String[hashtable.size()];
            Enumeration enumeration = hashtable.keys();
            for(int i = 0; enumeration.hasMoreElements(); i++)
            {
                Object obj = enumeration.nextElement();
                as[i] = obj + "=" + hashtable.get(obj);
            }

            a(as);
            return;
        }
        catch(Exception _ex)
        {
            return;
        }
    }

    public final Hashtable a()
    {
        Hashtable hashtable = new Hashtable();
        String as[];
        if((as = a()) != null && as.length > 0)
        {
            for(int i = 0; i < as.length; i++)
            {
                int j;
                if((j = as[i].indexOf('=')) != -1)
                    hashtable.put(as[i].substring(0, j), as[i].substring(j + 1));
            }

        }
        return hashtable;
        JVM INSTR pop ;
        return null;
    }

    public static void a(String s)
    {
        int i = ae.a();
        for(int j = 0; j < i; j++)
        {
            String s1 = ae.a(j).a;
            RecordStore recordstore;
            try
            {
                a(recordstore = RecordStore.openRecordStore(s1, false), s + s1);
            }
            catch(RecordStoreNotFoundException _ex) { }
            catch(RecordStoreException _ex) { }
        }

    }

    private static void a(RecordStore recordstore, String s)
    {
        try
        {
            RecordStore recordstore1 = RecordStore.openRecordStore(s, true);
            byte abyte0[];
            for(RecordEnumeration recordenumeration = recordstore.enumerateRecords(null, null, false); recordenumeration.hasNextElement(); recordstore1.addRecord(abyte0, 0, abyte0.length))
                abyte0 = recordenumeration.nextRecord();

            String s1 = recordstore.getName();
            recordstore1.closeRecordStore();
            recordstore.closeRecordStore();
            RecordStore.deleteRecordStore(s1);
            return;
        }
        catch(RecordStoreException _ex)
        {
            return;
        }
    }

    private static String a_java_lang_String_static_fld;
    private static String a_java_lang_String_array1d_static_fld[];
    private String b;
}