@Override public void serialize(boolean[] record, DataOutputView target) throws IOException { if (record == null) { throw new IllegalArgumentException("The record must not be null."); } final int len = record.length; target.writeInt(len); for (int i = 0; i < len; i++) { target.writeBoolean(record[i]); } }
@Override public void serialize(Byte record, DataOutputView target) throws IOException { target.writeByte(record.byteValue()); }
@Override public void serialize(float[] record, DataOutputView target) throws IOException { if (record == null) { throw new IllegalArgumentException("The record must not be null."); } final int len = record.length; target.writeInt(len); for (int i = 0; i < len; i++) { target.writeFloat(record[i]); } }
@Override public void serialize(char[] record, DataOutputView target) throws IOException { if (record == null) { throw new IllegalArgumentException("The record must not be null."); } final int len = record.length; target.writeInt(len); for (int i = 0; i < len; i++) { target.writeChar(record[i]); } }
@Override public void serialize(double[] record, DataOutputView target) throws IOException { if (record == null) { throw new IllegalArgumentException("The record must not be null."); } final int len = record.length; target.writeInt(len); for (int i = 0; i < len; i++) { target.writeDouble(record[i]); } }
@Override public void writeWithKeyNormalization(VertexWithRankAndDangling record, DataOutputView target) throws IOException { target.writeLong(record.getVertexID() - Long.MIN_VALUE); target.writeDouble(record.getRank()); target.writeBoolean(record.isDangling()); }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { target.write(source, 4); } }
@Override public void serialize(long[] record, DataOutputView target) throws IOException { if (record == null) { throw new IllegalArgumentException("The record must not be null."); } final int len = record.length; target.writeInt(len); for (int i = 0; i < len; i++) { target.writeLong(record[i]); } }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { int val = source.readUnsignedByte(); target.writeByte(val); if (val >= MAX_BIT) { int shift = 7; int curr; val = val & 0x7f; while ((curr = source.readUnsignedByte()) >= MAX_BIT) { target.writeByte(curr); val |= (curr & 0x7f) << shift; shift += 7; } target.writeByte(curr); val |= curr << shift; } target.write(source, val); };
@Override public void serialize(Boolean record, DataOutputView target) throws IOException { target.writeBoolean(record.booleanValue()); }
@Override public void serialize(VertexWithRank record, DataOutputView target) throws IOException { target.writeLong(record.getVertexID()); target.writeDouble(record.getRank()); }
@Override public void serialize(Double record, DataOutputView target) throws IOException { target.writeDouble(record.doubleValue()); }
@Override public void serialize(short[] record, DataOutputView target) throws IOException { if (record == null) { throw new IllegalArgumentException("The record must not be null."); } final int len = record.length; target.writeInt(len); for (int i = 0; i < len; i++) { target.writeShort(record[i]); } }
@Override public void serialize(Long record, DataOutputView target) throws IOException { target.writeLong(record.longValue()); }
@Override public void serialize(Short record, DataOutputView target) throws IOException { target.writeShort(record.shortValue()); }
@Override public void serialize(Character record, DataOutputView target) throws IOException { target.writeChar(record.charValue()); }
@Override public void serialize(Float record, DataOutputView target) throws IOException { target.writeFloat(record.floatValue()); }
@Override public void serialize(VertexWithRankAndDangling record, DataOutputView target) throws IOException { target.writeLong(record.getVertexID()); target.writeDouble(record.getRank()); target.writeBoolean(record.isDangling()); }