List of usage examples for org.apache.hadoop.io VersionMismatchException VersionMismatchException
public VersionMismatchException(byte expectedVersionIn, byte foundVersionIn)
From source file:org.apache.nutch.protocol.Content.java
License:Apache License
public final void readFields(DataInput in) throws IOException { metadata.clear();//from w w w . ja v a 2 s .c om int sizeOrVersion = in.readInt(); if (sizeOrVersion < 0) { // version version = sizeOrVersion; switch (version) { case VERSION: url = Text.readString(in); base = Text.readString(in); content = new byte[in.readInt()]; in.readFully(content); contentType = Text.readString(in); metadata.readFields(in); break; default: throw new VersionMismatchException((byte) VERSION, (byte) version); } } else { // size byte[] compressed = new byte[sizeOrVersion]; in.readFully(compressed, 0, compressed.length); ByteArrayInputStream deflated = new ByteArrayInputStream(compressed); DataInput inflater = new DataInputStream(new InflaterInputStream(deflated)); readFieldsCompressed(inflater); } }
From source file:org.apache.nutch.util.hostdb.HostDatum.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { byte version = in.readByte(); if (version > CUR_VERSION) // check version throw new VersionMismatchException(CUR_VERSION, version); score = in.readFloat();// w w w .j a va2 s .c o m lastCheck = new Date(in.readLong()); homepageUrl = Text.readString(in); dnsFailures = in.readInt(); connectionFailures = in.readInt(); statCounts.put(CrawlDatum.STATUS_DB_UNFETCHED, in.readInt()); statCounts.put(CrawlDatum.STATUS_DB_FETCHED, in.readInt()); statCounts.put(CrawlDatum.STATUS_DB_NOTMODIFIED, in.readInt()); statCounts.put(CrawlDatum.STATUS_DB_REDIR_PERM, in.readInt()); statCounts.put(CrawlDatum.STATUS_DB_REDIR_TEMP, in.readInt()); statCounts.put(CrawlDatum.STATUS_DB_GONE, in.readInt()); metaData = new MapWritable(); metaData.readFields(in); }
From source file:org.commoncrawl.util.CrawlDatum.java
License:Apache License
public void readFields(DataInput in) throws IOException { byte version = in.readByte(); // read version if (version > CUR_VERSION) // check version throw new VersionMismatchException(CUR_VERSION, version); status = in.readByte();/* w w w .j a v a2s. c o m*/ fetchTime = in.readLong(); retries = in.readByte(); if (version > 5) { fetchInterval = in.readInt(); } else fetchInterval = Math.round(in.readFloat()); score = in.readFloat(); if (version > 2) { modifiedTime = in.readLong(); int cnt = in.readByte(); if (cnt > 0) { signature = new byte[cnt]; in.readFully(signature); } else signature = null; } if (version > 3) { metaData.clear(); if (in.readBoolean()) { metaData.readFields(in); } } // translate status codes if (version < 5) { if (oldToNew.containsKey(status)) status = oldToNew.get(status); else status = STATUS_DB_UNFETCHED; } }