コード例 #1
0
 @Override
 public byte[][] serializeType(RyaType ryaType) throws RyaTypeResolverException {
   byte[] bytes = serializeData(ryaType.getData()).getBytes();
   return new byte[][] {
     bytes,
     Bytes.concat(
         TYPE_DELIM_BYTES,
         ryaType.getDataType().stringValue().getBytes(),
         TYPE_DELIM_BYTES,
         markerBytes)
   };
 }
コード例 #2
0
 @Override
 public RyaType deserialize(byte[] bytes) throws RyaTypeResolverException {
   if (!deserializable(bytes)) {
     throw new RyaTypeResolverException("Bytes not deserializable");
   }
   RyaType rt = newInstance();
   int length = bytes.length;
   int indexOfType = Bytes.indexOf(bytes, TYPE_DELIM_BYTE);
   if (indexOfType < 1) {
     throw new RyaTypeResolverException("Not a datatype literal");
   }
   String label = deserializeData(new String(bytes, 0, indexOfType));
   rt.setDataType(new URIImpl(new String(bytes, indexOfType + 1, (length - indexOfType) - 3)));
   rt.setData(label);
   return rt;
 }