public static BlockKeyProto convert(BlockKey key) { byte[] encodedKey = key.getEncodedKey(); ByteString keyBytes = ByteString.copyFrom(encodedKey == null ? DFSUtil.EMPTY_BYTES : encodedKey); return BlockKeyProto.newBuilder().setKeyId(key.getKeyId()) .setKeyBytes(keyBytes).setExpiryDate(key.getExpiryDate()).build(); }
public static BlockKey[] convertBlockKeys(List<BlockKeyProto> list) { BlockKey[] ret = new BlockKey[list.size()]; int i = 0; for (BlockKeyProto k : list) { ret[i++] = convert(k); } return ret; }
@Test public void testConvertBlockKey() { BlockKey key = getBlockKey(1); BlockKeyProto keyProto = PBHelper.convert(key); BlockKey key1 = PBHelper.convert(keyProto); compare(key, key1); }
public static BlockKeyProto convert(BlockKey key) { byte[] encodedKey = key.getEncodedKey(); ByteString keyBytes = ByteString.copyFrom(encodedKey == null ? new byte[0] : encodedKey); return BlockKeyProto.newBuilder().setKeyId(key.getKeyId()) .setKeyBytes(keyBytes).setExpiryDate(key.getExpiryDate()).build(); }
public static BlockKey convert(BlockKeyProto k) { return new BlockKey(k.getKeyId(), k.getExpiryDate(), k.getKeyBytes() .toByteArray()); }
public static BlockKey convert(BlockKeyProto k) { return new BlockKey(k.getKeyId(), k.getExpiryDate(), k.getKeyBytes().toByteArray()); }