mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
21 lines
601 B
Java
21 lines
601 B
Java
package net.sf.briar.protocol;
|
|
|
|
import java.io.IOException;
|
|
|
|
import net.sf.briar.api.FormatException;
|
|
import net.sf.briar.api.protocol.BatchId;
|
|
import net.sf.briar.api.protocol.Types;
|
|
import net.sf.briar.api.protocol.UniqueId;
|
|
import net.sf.briar.api.serial.ObjectReader;
|
|
import net.sf.briar.api.serial.Reader;
|
|
|
|
class BatchIdReader implements ObjectReader<BatchId> {
|
|
|
|
public BatchId readObject(Reader r) throws IOException {
|
|
r.readUserDefinedId(Types.BATCH_ID);
|
|
byte[] b = r.readBytes(UniqueId.LENGTH);
|
|
if(b.length != UniqueId.LENGTH) throw new FormatException();
|
|
return new BatchId(b);
|
|
}
|
|
}
|