@Override public ValueContainer deserialize(SerializerInput in) throws IOException, ClassNotFoundException { ArrayList<ArrayList<Datum>> tuples = new ArrayList<ArrayList<Datum>>(); int count = in.readInt(); for (int i = 0; i < count; i++) { ArrayList<Datum> tuple = new ArrayList<Datum>(); for (ColumnDefinition datumType : colsDef) { if (datumType.getColDataType().getDataType().equalsIgnoreCase("long") || datumType.getColDataType().getDataType().equalsIgnoreCase("int") || datumType.getColDataType().getDataType().equalsIgnoreCase("number") || datumType.getColDataType().getDataType().equalsIgnoreCase("integer")) { tuple.add(new Datum.DatumLong(in.readLong())); } else if (datumType.getColDataType().getDataType().equalsIgnoreCase("double") || datumType.getColDataType().getDataType().equalsIgnoreCase("float") || datumType.getColDataType().getDataType().equalsIgnoreCase("decimal")) { tuple.add(new Datum.DatumDouble(in.readDouble())); } else if (datumType.getColDataType().getDataType().equalsIgnoreCase("date")) { @SuppressWarnings("deprecation") Date date = new Date(in.readInt(), in.readInt(), in.readInt()); tuple.add(new Datum.DatumDate(date)); } else { tuple.add(new Datum.DatumString(in.readUTF())); } } tuples.add(tuple); } ValueContainer value = new ValueContainer(tuples); return value; }
public HashNode deserialize(SerializerInput ds) throws IOException { try { int i = ds.read(); if (i == Serialization.HTREE_BUCKET) { // is HashBucket? HashBucket ret = new HashBucket(HTree.this); ret.readExternal(ds); if (ds.available() != 0 && ds.read() != -1) // -1 is fix for compression, not sure what is happening throw new InternalError("bytes left: " + ds.available()); return ret; } else if (i == Serialization.HTREE_DIRECTORY) { HashDirectory ret = new HashDirectory(HTree.this); ret.readExternal(ds); if (ds.available() != 0 && ds.read() != -1) // -1 is fix for compression, not sure what is happening throw new InternalError("bytes left: " + ds.available()); return ret; } else { throw new InternalError("Wrong HTree header: " + i); } } catch (ClassNotFoundException e) { throw new IOException(e); } }