Converted the outgoing encryption layer from frames to segments.

This commit is contained in:
akwizgran
2012-01-17 17:37:38 +00:00
parent f6ed6dd60b
commit 87e1c42bf8
15 changed files with 214 additions and 102 deletions

View File

@@ -3,6 +3,8 @@ package net.sf.briar.transport;
import java.io.IOException;
import java.io.OutputStream;
import net.sf.briar.api.plugins.Segment;
/** An encryption layer that performs no encryption. */
class NullOutgoingEncryptionLayer implements OutgoingEncryptionLayer {
@@ -20,9 +22,9 @@ class NullOutgoingEncryptionLayer implements OutgoingEncryptionLayer {
this.capacity = capacity;
}
public void writeFrame(byte[] b, int len) throws IOException {
out.write(b, 0, len);
capacity -= len;
public void writeSegment(Segment s) throws IOException {
out.write(s.getBuffer(), 0, s.getLength());
capacity -= s.getLength();
}
public void flush() throws IOException {