1 2 3 4 package net.nutch.io; 5 6 import java.io.DataOutput ; 7 import java.io.DataInput ; 8 import java.io.IOException ; 9 10 19 public abstract class VersionedWritable implements Writable { 20 21 22 public abstract byte getVersion(); 23 24 public void write(DataOutput out) throws IOException { 26 out.writeByte(getVersion()); } 28 29 public void readFields(DataInput in) throws IOException { 31 byte version = in.readByte(); if (version != getVersion()) 33 throw new VersionMismatchException(getVersion(),version); 34 } 35 36 37 } 38 | Popular Tags |