/** * Reads back from the zookeeper. The data read here is of the form written by * writeToZooKeeper(Map<byte[], Integer> entries). * * @param data * @return Labels and their ordinal details * @throws DeserializationException */ public static List<VisibilityLabel> readLabelsFromZKData(byte[] data) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(data)) { int pblen = ProtobufUtil.lengthOfPBMagic(); try { VisibilityLabelsRequest.Builder builder = VisibilityLabelsRequest.newBuilder(); ProtobufUtil.mergeFrom(builder, data, pblen, data.length - pblen); return builder.getVisLabelList(); } catch (IOException e) { throw new DeserializationException(e); } } return null; }
/** * Reads back from the zookeeper. The data read here is of the form written by * writeToZooKeeper(Map<byte[], Integer> entries). * * @param data * @return Labels and their ordinal details * @throws DeserializationException */ public static List<VisibilityLabel> readLabelsFromZKData(byte[] data) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(data)) { int pblen = ProtobufUtil.lengthOfPBMagic(); try { VisibilityLabelsRequest.Builder builder = VisibilityLabelsRequest.newBuilder(); ProtobufUtil.mergeFrom(builder, data, pblen, data.length - pblen); return builder.getVisLabelList(); } catch (IOException e) { throw new DeserializationException(e); } } return null; }