我有一些java序列化代码。它编译并正常运行。但生成的文件是空的。下面是我的代码
参数是整数数组列表、字符串数组列表或整数数组列表数组列表
Model model = new Model(
pennTreeTags,
tagsCount,
iOccurTable,
fOccurTable,
alVocab,
aiVocabCount,
wordTagTable,
fWordTagProb
);
try
{
FileInputStream fileIn = new FileInputStream(argv[2]);
ObjectInputStream in = new ObjectInputStream(fileIn);
model = (Model) in.readObject();
in.close();
fileIn.close();
}
catch (EOFException ex)
{
//This exception will be caught when EOF is reached
System.out.println("End of file reached.");
}
catch(IOException i)
{
i.printStackTrace();
return;
}
catch(ClassNotFoundException c)
{
System.out.println("Model class not found");
c.printStackTrace();
return;
}