AVRO工具1.8.2 - 给出错误引起:java.io.IOException:同步无效!在第245行

时间:2018-04-02 13:47:01

标签: java apache avro avro-tools

我需要组合avro文件并将其推送到Azure blob商店。 我把它结合起来然后我再次尝试读取它我得到了错误。

我有一个文件,其中使用snappy组合avro文件。运行以下命令时:

java -jar .\avro-tools-1.8.2.jar tojson inputfile

我收到错误

Exception in thread "main" org.apache.avro.AvroRuntimeException: java.io.IOException: Invalid sync!

我调试了代码和syncBuffer与header.sync比较的下面一行给出了问题。任何想法可能是什么问题。

DataFileStream.DataBlock nextRawBlock(DataFileStream.DataBlock reuse) throws IOException {
    if (!this.hasNextBlock()) {
        throw new NoSuchElementException();
    } else {
        if (reuse != null && reuse.data.length >= (int)this.blockSize) {
            reuse.numEntries = this.blockRemaining;
            reuse.blockSize = (int)this.blockSize;
        } else {
            reuse = new DataFileStream.DataBlock(this.blockRemaining, (int)this.blockSize);
        }

        this.vin.readFixed(reuse.data, 0, reuse.blockSize);
        this.vin.readFixed(this.syncBuffer);
        this.availableBlock = false;
        if (!Arrays.equals(this.syncBuffer, this.header.sync)) {
            throw new IOException("Invalid sync!");
        } else {
            return reuse;
        }
    }
}

0 个答案:

没有答案