Establish some rules for handling InputStreams

* Methods shouldn't place any special requirements on the streams
  passed into them
* This implies that if a stream's going to be marked and reset,
  that should all happen within one method
* This also implies that if a method needs to mark and reset a stream,
  it should wrap the stream in a BufferedInputStream before doing so,
  rather than requiring a markable stream to be passed in
This commit is contained in:
Torsten Grote
2018-12-07 16:13:07 -02:00
parent e85fbfb952
commit 3cfb04b60d
4 changed files with 16 additions and 23 deletions

View File

@@ -8,6 +8,7 @@ import org.briarproject.bramble.api.sync.GroupId;
import org.briarproject.bramble.api.sync.MessageId;
import org.briarproject.briar.api.conversation.ConversationManager.ConversationClient;
import java.io.IOException;
import java.io.InputStream;
@NotNullByDefault
@@ -37,7 +38,7 @@ public interface MessagingManager extends ConversationClient {
* Stores a local attachment message.
*/
AttachmentHeader addLocalAttachment(GroupId groupId, long timestamp,
String contentType, InputStream is) throws DbException;
String contentType, InputStream is) throws DbException, IOException;
/**
* Returns the ID of the contact with the given private conversation.