List of usage examples for org.apache.hadoop.io WritableUtils readVInt
public static int readVInt(DataInput stream) throws IOException
From source file:com.placeiq.piqconnect.BlockWritable.java
License:Apache License
@Override public void readFields(DataInput dataInput) throws IOException { reset();/*from w w w . j a v a 2s . c o m*/ int v = WritableUtils.readVInt(dataInput); type = TYPE.get(v & 0x03); if (!TYPE.MATRIX.equals(type)) { int n = v >> 2; vectorElemValues.ensureCapacity(n); vectorElemValues.fill(0, n, -1); while (true) { int idx = WritableUtils.readVInt(dataInput); if (idx == END_OF_LIST) { break; } long value = WritableUtils.readVLong(dataInput); vectorElemValues.setQuick(idx, value); } } else { long n = v >> 2; blockRow = WritableUtils.readVLong(dataInput); for (int i = 0; i < n; i++) { matrixElemIndexes.add(WritableUtils.readVInt(dataInput)); } } }
From source file:com.sina.sdptools.app.hfilesync.core.HRegionInfo94.java
License:Apache License
private static byte[] readByteArray(DataInput in) throws IOException { int len = WritableUtils.readVInt(in); if (len < 0) { throw new NegativeArraySizeException(Integer.toString(len)); }//from w w w. jav a 2s . com byte[] result = new byte[len]; in.readFully(result, 0, len); return result; }
From source file:cosmos.records.impl.MapRecord.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { this.docId = Text.readString(in); final int cvLength = WritableUtils.readVInt(in); final byte[] cvBytes = new byte[cvLength]; in.readFully(cvBytes);/*w ww . j a v a 2s.c o m*/ this.docVisibility = new ColumnVisibility(cvBytes); final int entryCount = WritableUtils.readVInt(in); this.document = Maps.newHashMapWithExpectedSize(entryCount); for (int i = 0; i < entryCount; i++) { this.document.put(Column.recreate(in), RecordValue.recreate(in)); } }
From source file:cosmos.records.impl.MultimapRecord.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { this.docId = Text.readString(in); final int cvLength = WritableUtils.readVInt(in); final byte[] cvBytes = new byte[cvLength]; in.readFully(cvBytes);/*from w ww . j a v a 2 s. c o m*/ this.docVisibility = new ColumnVisibility(cvBytes); final int entryCount = WritableUtils.readVInt(in); this.document = HashMultimap.create(); for (int i = 0; i < entryCount; i++) { this.document.put(Column.recreate(in), RecordValue.recreate(in)); } }
From source file:cosmos.records.values.IntegerRecordValue.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { readVisibility(in); this.value = WritableUtils.readVInt(in); }
From source file:cosmos.records.values.RecordValue.java
License:Apache License
public void readVisibility(DataInput in) throws IOException { final int cvLength = WritableUtils.readVInt(in); final byte[] cvBytes = new byte[cvLength]; in.readFully(cvBytes);/*from ww w .j av a2 s . c o m*/ this.visibility = new ColumnVisibility(cvBytes); }
From source file:edu.gslis.streamcorpus.StreamItemWritable.java
License:Apache License
/** * Serializes this object.//from w w w .j ava2 s. c o m */ @Override public void readFields(DataInput in) throws IOException { try { int length = WritableUtils.readVInt(in); byte[] bytes = new byte[length]; in.readFully(bytes, 0, length); deserializer.deserialize(this, bytes); // WikipediaPage.readPage(this, new String(bytes)); // language = in.readUTF(); } catch (TException e) { e.printStackTrace(); throw new IOException(e); } }
From source file:edu.isi.mavuno.input.TrecDocument.java
License:Apache License
/** * Serializes this object./*from www. j ava2s . com*/ */ @Override public void readFields(DataInput in) throws IOException { int length = WritableUtils.readVInt(in); byte[] bytes = new byte[length]; in.readFully(bytes, 0, length); TrecDocument.readDocument(this, new String(bytes)); }
From source file:edu.uci.ics.biggraph.io.VIntWritable.java
License:Apache License
public void readFields(DataInput in) throws IOException { value = WritableUtils.readVInt(in); }
From source file:edu.umd.cloud9.collection.aquaint2.Aquaint2Document.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { int length = WritableUtils.readVInt(in); byte[] bytes = new byte[length]; in.readFully(bytes, 0, length);//from ww w .j av a 2 s . c om Aquaint2Document.readDocument(this, new String(bytes)); }