Files
briar/components/net/sf/briar/protocol/AuthorImpl.java
akwizgran 3f61d0c3df Changed the message format to store the author and group inline - this
doesn't take a huge amount of space and allows every message to be
self-certifying.
2011-07-25 21:14:16 +01:00

40 lines
771 B
Java

package net.sf.briar.protocol;
import java.io.IOException;
import net.sf.briar.api.protocol.Author;
import net.sf.briar.api.protocol.AuthorId;
import net.sf.briar.api.protocol.Tags;
import net.sf.briar.api.serial.Writer;
class AuthorImpl implements Author {
private final AuthorId id;
private final String name;
private final byte[] publicKey;
AuthorImpl(AuthorId id, String name, byte[] publicKey) {
this.id = id;
this.name = name;
this.publicKey = publicKey;
}
public AuthorId getId() {
return id;
}
public String getName() {
return name;
}
public byte[] getPublicKey() {
return publicKey;
}
public void writeTo(Writer w) throws IOException {
w.writeUserDefinedTag(Tags.AUTHOR);
w.writeString(name);
w.writeBytes(publicKey);
}
}