Changed the root package from net.sf.briar to org.briarproject.

This commit is contained in:
akwizgran
2014-01-08 16:18:30 +00:00
parent dce70f487c
commit 832476412c
427 changed files with 2507 additions and 2507 deletions

View File

@@ -0,0 +1,14 @@
package org.briarproject.api.system;
/**
* An interface for time-related system functions that allows them to be
* replaced for testing.
*/
public interface Clock {
/** @see {@link java.lang.System#currentTimeMillis()} */
long currentTimeMillis();
/** @see {@link java.lang.Thread.sleep(long)} */
void sleep(long milliseconds) throws InterruptedException;
}

View File

@@ -0,0 +1,9 @@
package org.briarproject.api.system;
import java.io.File;
import java.io.IOException;
public interface FileUtils {
long getFreeSpace(File f) throws IOException;
}

View File

@@ -0,0 +1,13 @@
package org.briarproject.api.system;
/** Default clock implementation. */
public class SystemClock implements Clock {
public long currentTimeMillis() {
return System.currentTimeMillis();
}
public void sleep(long milliseconds) throws InterruptedException {
Thread.sleep(milliseconds);
}
}

View File

@@ -0,0 +1,29 @@
package org.briarproject.api.system;
import java.util.TimerTask;
/** Default timer implementation. */
public class SystemTimer implements Timer {
private final java.util.Timer timer = new java.util.Timer();
public void cancel() {
timer.cancel();
}
public int purge() {
return timer.purge();
}
public void schedule(TimerTask task, long delay) {
timer.schedule(task, delay);
}
public void schedule(TimerTask task, long delay, long period) {
timer.schedule(task, delay, period);
}
public void scheduleAtFixedRate(TimerTask task, long delay, long period) {
timer.scheduleAtFixedRate(task, delay, period);
}
}

View File

@@ -0,0 +1,27 @@
package org.briarproject.api.system;
import java.util.TimerTask;
/**
* A wrapper around a {@link java.util.Timer} that allows it to be replaced for
* testing.
*/
public interface Timer {
/** @see {@link java.util.Timer#cancel()} */
void cancel();
/** @see {@link java.util.Timer#purge()} */
int purge();
/** @see {@link java.util.Timer#schedule(TimerTask, long)} */
void schedule(TimerTask task, long delay);
/** @see {@link java.util.Timer#schedule(TimerTask, long, long)} */
void schedule(TimerTask task, long delay, long period);
/**
* @see {@link java.util.Timer#scheduleAtFixedRate(TimerTask, long, long)}
*/
void scheduleAtFixedRate(TimerTask task, long delay, long period);
}