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

📄 account.java

📁 j2me简单实例,j2me教程加源码,希望大家喜欢
💻 JAVA
字号:
package com.j2medev.chapter3;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import javax.microedition.lcdui.Image;

public class Account {
    
    public int id = -1;
    public String name = "";
    public byte[] picture = null;
    public CustomInfo info = null;
    
    public Account() {
    }
    
    public void serialize(DataOutputStream dos) throws IOException{
        dos.writeInt(id);
        dos.writeUTF(name);
        dos.writeInt(picture.length);
        dos.write(picture);
        info.serialize(dos);
    }
    
    public static Account deserialize(DataInputStream dis) throws IOException{
        Account a = new Account();
        a.id = dis.readInt();
        a.name = dis.readUTF();
        int length = dis.readInt();
        a.picture = new byte[length];
        dis.read(a.picture);
        a.info = CustomInfo.deserialize(dis);
        return a;
    }
}

⌨️ 快捷键说明

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