mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 15:19:53 +01:00
Updated transport constants and renamed some test classes.
This commit is contained in:
35
test/net/sf/briar/transport/NullOutgoingEncryptionLayer.java
Normal file
35
test/net/sf/briar/transport/NullOutgoingEncryptionLayer.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/** An encryption layer that performs no encryption. */
|
||||
class NullOutgoingEncryptionLayer implements OutgoingEncryptionLayer {
|
||||
|
||||
private final OutputStream out;
|
||||
|
||||
private long capacity;
|
||||
|
||||
NullOutgoingEncryptionLayer(OutputStream out) {
|
||||
this.out = out;
|
||||
capacity = Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
NullOutgoingEncryptionLayer(OutputStream out, long capacity) {
|
||||
this.out = out;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public void writeFrame(byte[] b, int len) throws IOException {
|
||||
out.write(b, 0, len);
|
||||
capacity -= len;
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
out.flush();
|
||||
}
|
||||
|
||||
public long getRemainingCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user