/** * Write contents of this instance as CredentialsProto message to DataOutput. * @param out * @throws IOException */ void writeProto(DataOutput out) throws IOException { CredentialsProto.Builder storage = CredentialsProto.newBuilder(); for (Map.Entry<Text, Token<? extends TokenIdentifier>> e : tokenMap.entrySet()) { CredentialsKVProto.Builder kv = CredentialsKVProto.newBuilder(). setAliasBytes(ByteString.copyFrom( e.getKey().getBytes(), 0, e.getKey().getLength())). setToken(e.getValue().toTokenProto()); storage.addTokens(kv.build()); } for(Map.Entry<Text, byte[]> e : secretKeysMap.entrySet()) { CredentialsKVProto.Builder kv = CredentialsKVProto.newBuilder(). setAliasBytes(ByteString.copyFrom( e.getKey().getBytes(), 0, e.getKey().getLength())). setSecret(ByteString.copyFrom(e.getValue())); storage.addSecrets(kv.build()); } storage.build().writeDelimitedTo((DataOutputStream)out); }
public Builder toBuilder() { return newBuilder(this); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.hadoop.security.proto.SecurityProtos.CredentialsProto prototype) {
public static Builder newBuilder(org.apache.hadoop.security.proto.SecurityProtos.CredentialsProto prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }