⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 record.java

📁 充气球的j2me代码,可以自由的部署在eclipse,netbeas里面.希望大家喜欢.
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   Record.java

import java.io.*;
import javax.microedition.rms.RecordStore;

public class Record
{

    private static RecordStore rs;

    public Record()
    {
    }

    public static void open()
    {
        try
        {
            rs = RecordStore.openRecordStore(Resources.QRS, true);
        }
        catch(Exception e) { }
    }

    public static void close()
    {
        try
        {
            rs.closeRecordStore();
        }
        catch(Exception e) { }
    }

    public static void delete()
    {
        if(RecordStore.listRecordStores() != null)
            try
            {
                RecordStore.deleteRecordStore(Resources.QRS);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
    }

    public static void save()
    {
        try
        {
            ByteArrayOutputStream arrBytes = new ByteArrayOutputStream();
            DataOutputStream Data = new DataOutputStream(arrBytes);
            for(int i = 0; i < 5; i++)
            {
                Data.writeUTF(Resources.highscore[i]);
                Data.flush();
                byte b[] = arrBytes.toByteArray();
                int num = rs.addRecord(b, 0, b.length);
                arrBytes.reset();
            }

            arrBytes.close();
            Data.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public static void load()
    {
        try
        {
            byte b[] = new byte[50];
            ByteArrayInputStream arrBytes = new ByteArrayInputStream(b);
            DataInputStream Data = new DataInputStream(arrBytes);
            for(int i = 1; i <= rs.getNumRecords(); i++)
            {
                rs.getRecord(i, b, 0);
                String s = Data.readUTF();
                Resources.highscore[i - 1] = s;
                arrBytes.reset();
            }

            arrBytes.close();
            Data.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public static String getLevel(int x)
    {
        return String.valueOf(x);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -