问题描述
- java io invalid stream header: 776F7264
-
java.io.StreamCorruptedException: invalid stream header: 776F7264 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299) at dictionary.DictionaryClass.load(DictionaryClass.java:105) at dictionary.DictionaryClass.<init>(DictionaryClass.java:21) at dictionary.Dictionary.<init>(Dictionary.java:14) at dictionary.Dictionary.main(Dictionary.java:19)
System.out.println("反序列化进行中"); File f2 = new File("F:Text.txt"); ObjectInputStream ois = null; FileInputStream fis = null; try { fis = new FileInputStream(f2); ois = new ObjectInputStream(fis); if (f2.exists()) { System.out.println("反序列化对集合赋值"); this.collection = (ArrayList<DictionaryNum>) ois.readObject(); System.out.println("赋值成功"); ois.close(); } else {
解决方案
java.io.StreamCorruptedException: invalid stream header: EFBFBDEF
java.io.StreamCorruptedException: invalid stream header报错原因
解决方案二:
你确认原始数据是序列化过的吗
时间: 2024-09-30 18:40:00