コード例 #1
0
 public void testMarshalledValueGetMarshalling() throws Exception {
   Pojo ext = new Pojo();
   MarshalledValue mv = new MarshalledValue(ext, true, marshaller);
   byte[] bytes = marshaller.objectToByteBuffer(mv);
   MarshalledValue rmv = (MarshalledValue) marshaller.objectFromByteBuffer(bytes);
   assert rmv.equals(mv) : "Writen[" + mv + "] and read[" + rmv + "] objects should be the same";
   assert rmv.get() instanceof Pojo;
 }
コード例 #2
0
 @Override
 public V read(MarshalledValue<V, C> value) throws InvalidSerializedFormException {
   if (value == null) return null;
   try {
     return value.get(this.context);
   } catch (ClassNotFoundException | InvalidClassException | InvalidObjectException e) {
     throw new InvalidSerializedFormException(e);
   } catch (IOException e) {
     throw new IllegalArgumentException(e);
   }
 }