mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 06:39:54 +01:00
Removed println.
This commit is contained in:
@@ -6,10 +6,7 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.io.FileSystemUtils;
|
|
||||||
|
|
||||||
import net.sf.briar.api.ContactId;
|
import net.sf.briar.api.ContactId;
|
||||||
import net.sf.briar.api.TransportId;
|
|
||||||
import net.sf.briar.api.transport.InvalidConfigException;
|
import net.sf.briar.api.transport.InvalidConfigException;
|
||||||
import net.sf.briar.api.transport.InvalidTransportException;
|
import net.sf.briar.api.transport.InvalidTransportException;
|
||||||
import net.sf.briar.api.transport.TransportConstants;
|
import net.sf.briar.api.transport.TransportConstants;
|
||||||
@@ -18,25 +15,19 @@ import net.sf.briar.api.transport.batch.BatchTransportPlugin;
|
|||||||
import net.sf.briar.api.transport.batch.BatchTransportReader;
|
import net.sf.briar.api.transport.batch.BatchTransportReader;
|
||||||
import net.sf.briar.api.transport.batch.BatchTransportWriter;
|
import net.sf.briar.api.transport.batch.BatchTransportWriter;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileSystemUtils;
|
||||||
|
|
||||||
abstract class FilePlugin implements BatchTransportPlugin {
|
abstract class FilePlugin implements BatchTransportPlugin {
|
||||||
|
|
||||||
public static final int TRANSPORT_ID = 0;
|
|
||||||
|
|
||||||
private static final TransportId id = new TransportId(TRANSPORT_ID);
|
|
||||||
|
|
||||||
private boolean started = false;
|
|
||||||
protected Map<String, String> localProperties = null;
|
protected Map<String, String> localProperties = null;
|
||||||
protected Map<ContactId, Map<String, String>> remoteProperties = null;
|
protected Map<ContactId, Map<String, String>> remoteProperties = null;
|
||||||
protected Map<String, String> config = null;
|
protected Map<String, String> config = null;
|
||||||
protected BatchTransportCallback callback = null;
|
protected BatchTransportCallback callback = null;
|
||||||
|
private boolean started = false;
|
||||||
|
|
||||||
protected abstract File chooseOutputDirectory();
|
protected abstract File chooseOutputDirectory();
|
||||||
protected abstract void writerFinished(File f);
|
protected abstract void writerFinished(File f);
|
||||||
|
|
||||||
public TransportId getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void start(Map<String, String> localProperties,
|
public synchronized void start(Map<String, String> localProperties,
|
||||||
Map<ContactId, Map<String, String>> remoteProperties,
|
Map<ContactId, Map<String, String>> remoteProperties,
|
||||||
Map<String, String> config, BatchTransportCallback callback)
|
Map<String, String> config, BatchTransportCallback callback)
|
||||||
@@ -92,9 +83,7 @@ abstract class FilePlugin implements BatchTransportPlugin {
|
|||||||
public BatchTransportWriter createWriter(ContactId c) {
|
public BatchTransportWriter createWriter(ContactId c) {
|
||||||
if(!started) throw new IllegalStateException();
|
if(!started) throw new IllegalStateException();
|
||||||
File dir = chooseOutputDirectory();
|
File dir = chooseOutputDirectory();
|
||||||
if(dir == null) return null;
|
if(dir == null || !dir.exists() || !dir.isDirectory()) return null;
|
||||||
if(!dir.exists()) return null;
|
|
||||||
if(!dir.isDirectory()) return null;
|
|
||||||
File f = new File(dir, createFilename());
|
File f = new File(dir, createFilename());
|
||||||
try {
|
try {
|
||||||
long capacity = getCapacity(f.getAbsolutePath());
|
long capacity = getCapacity(f.getAbsolutePath());
|
||||||
@@ -111,7 +100,6 @@ abstract class FilePlugin implements BatchTransportPlugin {
|
|||||||
StringBuilder s = new StringBuilder(12);
|
StringBuilder s = new StringBuilder(12);
|
||||||
for(int i = 0; i < 8; i++) s.append((char) ('a' + Math.random() * 26));
|
for(int i = 0; i < 8; i++) s.append((char) ('a' + Math.random() * 26));
|
||||||
s.append(".dat");
|
s.append(".dat");
|
||||||
System.out.println(s);
|
|
||||||
return s.toString();
|
return s.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user