梦幻西游地图map001错误

梦幻西游地图map001错误,第1张

文件1001.map损坏导致的。在登录闷亏梦幻西游时出现map001错误这种情况,一般是由于电脑梦幻西饥行游scene目录下的场景文件1001.map损坏导致的。应是以前更新游戏的时候曾经终止过,导致文件有损坏。烂罩哗

import java.io.*

import java.util.HashMap

import java.util.Map

public class ObjOpe {

/弯困滑/写入文件

public static void write(Object o,String file){

try{

ObjectOutputStream w = new ObjectOutputStream(new FileOutputStream(file))

w.writeObject(o)

w.flush()

w.close()

}catch(Exception e){}

}

/埋腊/读取文件

public static Object Reader(String file){

try{

ObjectInputStream in = new ObjectInputStream(new FileInputStream(file))

Object o = in.readObject()

in.close()

return o

}catch(Exception e){}

return null

}

//读写测试

public static void main(String[] args) throws Exception {

Map<String,Integer>map = new HashMap<String,Integer>()

map.put("0001",1)

map.put("0010",2)

System.out.println("保存前数据:")

Object[]ks = map.keySet().toArray()

for(int i=0i<ks.lengthi++)

System.out.println(ks[i]+"="+map.get(ks[i]))

String file = "my.code"尺纯

System.out.println("保存数据到文件:"+file)

ObjOpe.write(map,file)

System.out.println("保存数据到文件完成.")

System.out.println("从文件 "+file+" 读取数据:")

Object o = ObjOpe.Reader(file)

Map<String,Integer>m = (Map<String,Integer>)o

System.out.println("从文件读取到的数据:")

Object[]ks2 = map.keySet().toArray()

for(int i=0i<ks2.lengthi++)

System.out.println(ks2[i]+"="+map.get(ks2[i]))

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/tougao/12218119.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-21
下一篇2023-05-21

发表评论

登录后才能评论

评论列表(0条)

    保存