Implement SessionEncoder and SessionParser

This commit is contained in:
Torsten Grote
2018-04-18 12:04:33 -03:00
parent 672a52b2e5
commit e1fae7ad95
15 changed files with 1168 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package org.briarproject.briar.api.introduction2;
import org.briarproject.bramble.api.FormatException;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public enum Role {
INTRODUCER(0), INTRODUCEE(1);
private final int value;
Role(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static Role fromValue(int value) throws FormatException {
for (Role r : values()) if (r.value == value) return r;
throw new FormatException();
}
}