mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Merge branch '1242-attachment-input-stream' into 'master'
Attachments will use InputStream rather than ByteBuffer See merge request briar/briar!992
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
package org.briarproject.briar.api.messaging;
|
package org.briarproject.briar.api.messaging;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class Attachment {
|
public class Attachment {
|
||||||
|
|
||||||
private final ByteBuffer data;
|
private final InputStream stream;
|
||||||
|
|
||||||
public Attachment(ByteBuffer data) {
|
public Attachment(InputStream stream) {
|
||||||
this.data = data;
|
this.stream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer getData() {
|
public InputStream getStream() {
|
||||||
return data;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import javax.annotation.concurrent.Immutable;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_MESSAGE_BODY_LENGTH;
|
|
||||||
import static org.briarproject.briar.client.MessageTrackerConstants.MSG_KEY_READ;
|
import static org.briarproject.briar.client.MessageTrackerConstants.MSG_KEY_READ;
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@@ -238,10 +237,7 @@ class MessagingManagerImpl extends ConversationClientImpl
|
|||||||
@Override
|
@Override
|
||||||
public Attachment getAttachment(MessageId m) {
|
public Attachment getAttachment(MessageId m) {
|
||||||
// TODO add real implementation
|
// TODO add real implementation
|
||||||
// TODO return actual random/fake image before real implementation is done
|
throw new IllegalStateException("Not yet implemented");
|
||||||
byte[] b = new byte[MAX_MESSAGE_BODY_LENGTH];
|
|
||||||
new Random().nextBytes(b);
|
|
||||||
return new Attachment(ByteBuffer.wrap(b));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user