Added factory methods for segmented connection readers.

This commit is contained in:
akwizgran
2012-01-17 20:21:26 +00:00
parent 87e1c42bf8
commit dbeb7a207e
21 changed files with 175 additions and 88 deletions

View File

@@ -2,6 +2,8 @@ package net.sf.briar.api.plugins;
import java.io.IOException;
import net.sf.briar.api.transport.Segment;
public interface SegmentSink {
/** Writes the given segment. */

View File

@@ -2,6 +2,8 @@ package net.sf.briar.api.plugins;
import java.io.IOException;
import net.sf.briar.api.transport.Segment;
public interface SegmentSource {
/**

View File

@@ -2,6 +2,8 @@ package net.sf.briar.api.transport;
import java.io.InputStream;
import net.sf.briar.api.plugins.SegmentSource;
public interface ConnectionReaderFactory {
/**
@@ -12,9 +14,23 @@ public interface ConnectionReaderFactory {
ConnectionReader createConnectionReader(InputStream in, byte[] secret,
byte[] tag);
/**
* Creates a connection reader for a simplex connection or the initiator's
* side of a duplex connection. The secret is erased before this method
* returns.
*/
ConnectionReader createConnectionReader(SegmentSource in, byte[] secret,
Segment buffered);
/**
* Creates a connection reader for the responder's side of a duplex
* connection. The secret is erased before this method returns.
*/
ConnectionReader createConnectionReader(InputStream in, byte[] secret);
/**
* Creates a connection reader for the responder's side of a duplex
* connection. The secret is erased before this method returns.
*/
ConnectionReader createConnectionReader(SegmentSource in, byte[] secret);
}

View File

@@ -1,4 +1,4 @@
package net.sf.briar.api.plugins;
package net.sf.briar.api.transport;
public interface Segment {