Skip to content
Snippets Groups Projects
Commit 11a6858c authored by akwizgran's avatar akwizgran
Browse files

Updated transport plugin API.

parent 2d62b0ad
No related branches found
No related tags found
No related merge requests found
package net.sf.briar.api.transport;
import java.util.Map;
public interface TransportCallback {
void setLocalTransports(Map<String, String> transports);
void setConfig(Map<String, String> config);
void showMessage(String message);
boolean showConfirmationMessage(String message);
int showChoice(String message, String[] choices);
}
package net.sf.briar.api.transport.batch;
import java.util.Map;
import net.sf.briar.api.transport.TransportCallback;
/**
* An interface for receiving readers and writers created by a batch-mode
* transport plugin.
*/
public interface BatchTransportCallback {
public interface BatchTransportCallback extends TransportCallback {
void readerCreated(BatchTransportReader r);
void writerCreated(BatchTransportWriter w);
void setLocalTransports(Map<String, String> transports);
void setConfig(Map<String, String> config);
}
......@@ -16,9 +16,14 @@ public interface BatchTransportWriter {
OutputStream getOutputStream();
/**
* Closes the writer and disposes of any associated state. This method must
* be called even if the writer is not used, or if an exception is thrown
* while using the writer.
* Finishes writing to the transport. This method should be called after
* flushing and closing the output stream.
*/
void finish() throws IOException;
/**
* Disposes of any associated state. This method must be called even if the
* writer is not used, or if an exception is thrown while using the writer.
*/
void dispose() throws IOException;
}
package net.sf.briar.api.transport.stream;
import java.util.Map;
import net.sf.briar.api.transport.TransportCallback;
/**
* An interface for receiving connections created by a stream-mode transport
* plugin.
*/
public interface StreamTransportCallback {
public interface StreamTransportCallback extends TransportCallback {
void connectionCreated(StreamTransportConnection c);
void setLocalTransports(Map<String, String> transports);
void setConfig(Map<String, String> config);
}
......@@ -23,6 +23,10 @@ class TestBatchTransportWriter implements BatchTransportWriter {
return out;
}
public void finish() throws IOException {
// Nothing to do
}
public void dispose() throws IOException {
// The output stream may have been left open
out.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment