Exemplo n.º 1
0
 public void serialize(SerializerOutput out, HashNode obj) throws IOException {
   if (obj.getClass() == HashBucket.class) {
     out.write(Serialization.HTREE_BUCKET);
     HashBucket b = (HashBucket) obj;
     b.writeExternal(out);
   } else {
     out.write(Serialization.HTREE_DIRECTORY);
     HashDirectory n = (HashDirectory) obj;
     n.writeExternal(out);
   }
 }
 @SuppressWarnings("deprecation")
 @Override
 public void serialize(SerializerOutput out, ValueContainer value) throws IOException {
   out.writeInt(value.count);
   for (ArrayList<Datum> tuple : value.tuples) {
     int index = -1;
     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")) {
         out.writeLong((long) tuple.get(++index).getValue());
       } else if (datumType.getColDataType().getDataType().equalsIgnoreCase("double")
           || datumType.getColDataType().getDataType().equalsIgnoreCase("float")
           || datumType.getColDataType().getDataType().equalsIgnoreCase("decimal")) {
         out.writeDouble((double) tuple.get(++index).getValue());
       } else if (datumType.getColDataType().getDataType().equalsIgnoreCase("date")) {
         index++;
         out.writeInt(((Date) (tuple.get(index).getValue())).getYear());
         out.writeInt(((Date) (tuple.get(index).getValue())).getMonth());
         out.writeInt(((Date) (tuple.get(index).getValue())).getDate());
       } else {
         out.writeUTF(tuple.get(++index).getValue().toString());
       }
     }
   }
 }