我一直在研究用于 Java 的音频/视频容器(如 AVI),并且在从文件中读取块 id 标签时遇到了错误。以下是我遇到的错误;
java.io.UTFDataFormatException: malformed input around byte 10
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at com.hachisoftware.ism.ChunkInputStream.readChunk(ChunkInputStream.java:27)
at Main.run(Main.java:72)
at java.lang.Thread.run(Unknown Source)
at Main.main(Main.java:26)
错误发生在这String id = in.readUTF();
行代码中;
public Chunk readChunk(Chunk type) throws IOException {
String id = in.readUTF();
if(!type.chuckID.equalsIgnoreCase(id.toString()))
throw new IOException("Can't cast Chunk '" + type.chuckID + "' to '" + id + "'");
type.readChunk(in);
return type;
}
所有源代码都可以在以下位置找到:GitHub