mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Add input stream that fetches blocks from the DB.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package org.briarproject.bramble.api.io;
|
||||
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
|
||||
public interface BlockSource {
|
||||
|
||||
int getBlockCount(MessageId m) throws DbException;
|
||||
|
||||
byte[] getBlock(MessageId m, int blockNumber) throws DbException;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.bramble.api.io;
|
||||
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public interface MessageInputStreamFactory {
|
||||
|
||||
/**
|
||||
* Returns an {@link InputStream} for reading the given message from the
|
||||
* database. This method returns immediately. If the message is not in the
|
||||
* database or cannot be read, reading from the stream will throw an
|
||||
* {@link IOException};
|
||||
*/
|
||||
InputStream getMessageInputStream(MessageId m);
|
||||
}
|
||||
Reference in New Issue
Block a user