mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
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:
@@ -33,6 +33,7 @@ import org.briarproject.briar.api.messaging.event.PrivateMessageReceivedEvent;
|
||||
import org.briarproject.briar.client.ConversationClientImpl;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -154,8 +155,9 @@ class MessagingManagerImpl extends ConversationClientImpl
|
||||
|
||||
@Override
|
||||
public AttachmentHeader addLocalAttachment(GroupId groupId, long timestamp,
|
||||
String contentType, InputStream is) {
|
||||
String contentType, InputStream is) throws IOException {
|
||||
// TODO add real implementation
|
||||
if (is.available() == 0) throw new IOException();
|
||||
byte[] b = new byte[MessageId.LENGTH];
|
||||
new Random().nextBytes(b);
|
||||
return new AttachmentHeader(new MessageId(b), "image/png");
|
||||
|
||||
Reference in New Issue
Block a user