Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.infinispan.query.remote.indexing;
 
 import  org.infinispan.commons.io.UnsignedNumeric;
 import  org.infinispan.commons.marshall.AbstractExternalizer;
 
This is used to wrap binary values encoded with Protocol Buffers. ProtobufValueWrapperFieldBridge is used as a class bridge to allow indexing of the binary payload.

Author(s):
anistor@redhat.com
Since:
6.0
public final class ProtobufValueWrapper {
   // The protobuf encoded payload
   private final byte[] binary;
   private int hashCode = 0;
   public ProtobufValueWrapper(byte[] binary) {
      this. = binary;
   }
   public byte[] getBinary() {
      return ;
   }
   @Override
   public boolean equals(Object o) {
      if (this == oreturn true;
      if (o == null || getClass() != o.getClass()) return false;
      ProtobufValueWrapper that = (ProtobufValueWrappero;
      return Arrays.equals(that.binary);
   }
   @Override
   public int hashCode() {
      if ( == 0) {
          = Arrays.hashCode();
      }
      return ;
   }
   @Override
   public String toString() {
      return "ProtobufValueWrapper(" + Arrays.toString() + ')';
   }
   public static final class Externalizer extends AbstractExternalizer<ProtobufValueWrapper> {
      @Override
      public void writeObject(ObjectOutput outputProtobufValueWrapper protobufValueWrapperthrows IOException {
         UnsignedNumeric.writeUnsignedInt(outputprotobufValueWrapper.getBinary().length);
         output.write(protobufValueWrapper.getBinary());
      }
      @Override
      public ProtobufValueWrapper readObject(ObjectInput inputthrows IOException {
         int length = UnsignedNumeric.readUnsignedInt(input);
         byte[] binary = new byte[length];
         input.readFully(binary);
         return new ProtobufValueWrapper(binary);
      }
      @Override
      public Integer getId() {
         return .;
      }
      @Override
      public Set<Class<? extends ProtobufValueWrapper>> getTypeClasses() {
         return Collections.<Class<? extends ProtobufValueWrapper>>singleton(ProtobufValueWrapper.class);
      }
   }
New to GrepCode? Check out our FAQ X