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

📄 picture.java

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

import java.io.*;

public class Picture {
    
    public String name = "";//存储图片的名称
    public byte[] img = null; //存储图片数据

    public Picture() {
    }
    
    public Picture(String _name,byte[] _img){
        this.name = _name;
        this.img = _img;
    }
    
    public void serialize(DataOutputStream dos) throws IOException{
        dos.writeUTF(name);
        dos.writeInt(img.length);
        dos.write(img);
    }
    
    public static Picture deserialize(DataInputStream dis) throws IOException{
        Picture picture = new Picture();
        picture.name = dis.readUTF();
        picture.img = new byte[dis.readInt()];
        dis.read(picture.img);
        return picture;
    }
}

⌨️ 快捷键说明

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