特殊方式写的文件格式读取到内存(知道用什么内存存的数据用什么内存来接)

package com;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.Map;
import java.util.Map.Entry;

public class E {

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        String sf = "C:\\Users\\AOC\\ewwq\\N2\\.mc\\mcInfo.mc";
        syccc(sf);
        System.out.println("---------------------------------------");
        sf = "C:\\Users\\AOC\\ewwq\\N3\\.mc\\mcInfo.mc";
        syccc(sf);
    }

    public static Map<String, Map<String, String>> syccc(String sf) throws IOException, ClassNotFoundException {
        FileInputStream fin = new FileInputStream(sf);
        ObjectInputStream obs = new ObjectInputStream(fin);
        Map<String, Map<String, String>> map = (Map<String, Map<String, String>>) obs.readObject();
        for (Entry<String, Map<String, String>> mapec : map.entrySet()) {
            System.out.println(mapec.getKey() + "---------------" + mapec.getValue());
        }
        return map;
    }
}

 

posted @ 2019-09-20 17:22  再也不见  阅读(237)  评论(0编辑  收藏  举报