示例#1
0
 // @Override
 public static Filter parseFrom(final byte[] pbBytes) throws DeserializationException {
   FilterProtos.CustomFilter proto;
   try {
     proto =
         FilterProtos.CustomFilter.parseFrom(
             pbBytes); // co CustomFilter-7-Read Used by the servers to establish the filter
                       // instance with the correct values.
   } catch (InvalidProtocolBufferException e) {
     throw new DeserializationException(e);
   }
   return new CustomFilter(proto.getValue().toByteArray());
 }
示例#2
0
 @Override
 public byte[] toByteArray() {
   FilterProtos.CustomFilter.Builder builder = FilterProtos.CustomFilter.newBuilder();
   if (value != null)
     builder.setValue(
         ByteStringer.wrap(
             value)); // co CustomFilter-6-Write Writes the given value out so it can be sent to
                      // the servers.
   return builder.build().toByteArray();
 }