Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java

Issue 29347315: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: made helper methods static, fixed 'remove' for fs callback Created Dec. 13, 2016, 9:32 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/LogSystem.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java
similarity index 58%
copy from libadblockplus-android/src/org/adblockplus/libadblockplus/LogSystem.java
copy to libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java
index 548811c1cba44b981c76083afc8017f940028e50..92172ab8ff6ab10e3f57dd75a22b7f7a23e4398c 100644
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/LogSystem.java
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java
@@ -17,7 +17,7 @@
package org.adblockplus.libadblockplus;
-public abstract class LogSystem implements Disposable
+public abstract class FileSystem implements Disposable
{
private final Disposer disposer;
protected final long ptr;
@@ -28,18 +28,62 @@ public abstract class LogSystem implements Disposable
registerNatives();
}
- public LogSystem()
+ public FileSystem()
{
this.ptr = ctor(this);
this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
}
- public static enum LogLevel
+ public static class StatResult
{
- TRACE, LOG, INFO, WARN, ERROR;
+ private boolean exists;
+
+ public boolean exists()
+ {
+ return exists;
+ }
+
+ private boolean isDirectory;
+
+ public boolean isDirectory()
+ {
+ return isDirectory;
+ }
+
+ private boolean isFile;
+
+ public boolean isFile()
+ {
+ return isFile;
+ }
+
+ private long lastModified;
+
+ public long getLastModified()
+ {
+ return lastModified;
+ }
+
+ public StatResult(boolean exists, boolean isDirectory, boolean isFile, long lastModified)
+ {
+ this.exists = exists;
+ this.isDirectory = isDirectory;
+ this.isFile = isFile;
+ this.lastModified = lastModified;
+ }
}
- public abstract void logCallback(LogLevel level, String message, String source);
+ public abstract String read(String path);
+
+ public abstract void write(String path, String data);
+
+ public abstract void move(String fromPath, String toPath);
+
+ public abstract void remove(String path);
+
+ public abstract StatResult stat(String path);
+
+ public abstract String resolve(String path);
@Override
public void dispose()

Powered by Google App Engine
This is Rietveld