📄 readcharacter.java
字号:
package ECDictionaryUtil;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.Collection;
import java.util.HashMap;
public class ReadCharacter {
/**
* @param args
* @throws ClassNotFoundException
* @throws IOException
*/
public String readCharacters(ObjectInputStream is) throws IOException, ClassNotFoundException{
ObjectHead oh=(ObjectHead)is.readObject();
HashMap hm=oh.getHashMap();
if (!hm.isEmpty()){
Collection cel=hm.values();
readCollection(cel);
}
return null;
}
public void readCollection(Collection cel){
if(!cel.isEmpty()){
int i=0;
while(i<cel.size()){
CharacterObject charaOb=(CharacterObject)cel.toArray()[i];
System.out.print(charaOb.getChara());
readCollection(charaOb.getHashMap().values());
i++;
}
}
}
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
// TODO Auto-generated method stub
ObjectInputStream is =
new ObjectInputStream(
new FileInputStream("E:\\DictionaryTest\\Dictionary.out"));
ReadCharacter rc=new ReadCharacter();
rc.readCharacters(is);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -