156157158159160161162163
public void serialize(Datum value, DataOutput out) throws SerDeException { try { out.writeUTF(value.asString()); } catch (IOException e) { throw new SerDeException(e); } }
125126127128129130131132
@Override public Datum deserialize(DataInput in) throws SerDeException { try { return new IntegerDatum(in.readInt()); } catch (IOException e) { throw new SerDeException(e); } }
135136137138139140141142
public void serialize(Datum value, DataOutput out) throws SerDeException { try { out.writeInt(value.asInteger()); } catch (IOException e) { throw new SerDeException(e); } }
3536373839404142
SerDe<Datum> serDe = datumType.getSerDe(); // invariant: the SerDe for any Datum will NOT read its own type return serDe.deserialize(in); } catch (IOException e) { throw new SerDeException(e); } }
4950515253545556
try { // invariant: the SerDe for any Datum will NOT write its own type out.writeByte(datumType.getTypeAsByte()); serDe.serialize(value, out); } catch (IOException e) { throw new SerDeException(e); } }
121122123124125126127128
@Override public Datum deserialize(DataInput in) throws SerDeException { try { return new FloatDatum(in.readFloat()); } catch (IOException e) { throw new SerDeException(e); } }
131132133134135136137138
public void serialize(Datum value, DataOutput out) throws SerDeException { try { out.writeFloat(value.asFloat()); } catch (IOException e) { throw new SerDeException(e); } }
123124125126127128129130
in ) throws SerDeException { try { return new BooleanDatum(in.readBoolean()); } catch (IOException e) { throw new SerDeException(e); } }
133134135136137138139140
public void serialize(Datum value, DataOutput out) throws SerDeException { try { out.writeBoolean(value.asBoolean()); } catch (Exception e) { throw new SerDeException(e); } }
120121122123124125126127
@Override public Datum deserialize(DataInput in) throws SerDeException { try { return new LongDatum(in.readLong()); } catch (IOException e) { throw new SerDeException(e); } }