public static Token<BlockTokenIdentifier> fromProto(HdfsProtos.BlockTokenIdentifierProto proto) { return new Token<BlockTokenIdentifier>( proto.getIdentifier().toByteArray(), proto.getPassword().toByteArray(), new Text(proto.getKind()), new Text(proto.getService())); }
public static HdfsProtos.BlockTokenIdentifierProto toProto(Token<?> blockToken) { return HdfsProtos.BlockTokenIdentifierProto.newBuilder() .setIdentifier(ByteString.copyFrom(blockToken.getIdentifier())) .setPassword(ByteString.copyFrom(blockToken.getPassword())) .setKind(blockToken.getKind().toString()) .setService(blockToken.getService().toString()) .build(); }