index.java

来自「j2me简单实例,j2me教程加源码,希望大家喜欢」· Java 代码 · 共 33 行

JAVA
33
字号
package com.j2medev.chapter3;

import java.io.*;

/**
 *
 */
public class Index {
    
    public int id = 0;//存储数据记录的recordID
    public String key = "";//存储实际记录的主键

    public Index() {
    }
    
    public Index(int _id,String _key){
        this.id = _id;
        this.key = _key;
    }
    
    public void serialize(DataOutputStream dos) throws IOException{
        dos.writeInt(id);
        dos.writeUTF(key);
    }
    
    public static Index deserialize(DataInputStream dis) throws IOException{
        Index index = new Index();
        index.id = dis.readInt();
        index.key = dis.readUTF();
        return index;
    }
}

⌨️ 快捷键说明

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