예제 #1
0
    public long serializedSize(Slices slices, int version) {
      long size = TypeSizes.sizeofVInt(slices.size());

      if (slices.size() == 0) return size;

      List<AbstractType<?>> types =
          slices instanceof SelectAllSlices
              ? Collections.<AbstractType<?>>emptyList()
              : ((ArrayBackedSlices) slices).comparator.subtypes();

      for (Slice slice : slices) size += Slice.serializer.serializedSize(slice, version, types);

      return size;
    }
예제 #2
0
    public void serialize(Slices slices, DataOutputPlus out, int version) throws IOException {
      int size = slices.size();
      out.writeVInt(size);

      if (size == 0) return;

      List<AbstractType<?>> types =
          slices == ALL
              ? Collections.<AbstractType<?>>emptyList()
              : ((ArrayBackedSlices) slices).comparator.subtypes();

      for (Slice slice : slices) Slice.serializer.serialize(slice, out, version, types);
    }