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

Delta Between Two Patch Sets: libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Left Patch Set: using method from c++ utils Created April 28, 2017, 10:44 a.m.
Right Patch Set: changed impl for reading file as bytes array, modified test. AndroidFileSystem now does not resolve… Created May 29, 2017, 11:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return lastModified; 64 return lastModified;
65 } 65 }
66 66
67 public StatResult(boolean exists, boolean isDirectory, boolean isFile, long lastModified) 67 public StatResult(boolean exists, boolean isDirectory, boolean isFile, long lastModified)
68 { 68 {
69 this.exists = exists; 69 this.exists = exists;
70 this.isDirectory = isDirectory; 70 this.isDirectory = isDirectory;
71 this.isFile = isFile; 71 this.isFile = isFile;
72 this.lastModified = lastModified; 72 this.lastModified = lastModified;
73 } 73 }
74
75 @Override
76 public String toString()
77 {
78 return "StatResult{" +
79 "exists=" + exists +
80 ", isDirectory=" + isDirectory +
81 ", isFile=" + isFile +
82 ", lastModified=" + lastModified +
83 '}';
84 }
74 } 85 }
75 86
76 /** 87 /**
77 * Reads from a file. 88 * Reads from a file.
78 * @param path File path. 89 * @param path File path.
79 * @return File's content as string 90 * @return File's binary data.
80 */ 91 */
81 public abstract String read(String path); 92 public abstract byte[] read(String path);
82 93
83 /** 94 /**
84 * Writes to a file. 95 * Writes to a file.
85 * @param path File path. 96 * @param path File path.
86 * @param data File data to write. 97 * @param data File's binary data to write.
87 */ 98 */
88 public abstract void write(String path, String data); 99 public abstract void write(String path, byte[] data);
89 100
90 /** 101 /**
91 * Moves a file (i.e.\ renames it). 102 * Moves a file (i.e.\ renames it).
92 * @param fromPath Current path to the file. 103 * @param fromPath Current path to the file.
93 * @param toPath New path to the file. 104 * @param toPath New path to the file.
94 */ 105 */
95 public abstract void move(String fromPath, String toPath); 106 public abstract void move(String fromPath, String toPath);
96 107
97 /** 108 /**
98 * Removes a file. 109 * Removes a file.
(...skipping 14 matching lines...) Expand all
113 * @return Absolute file path. 124 * @return Absolute file path.
114 */ 125 */
115 public abstract String resolve(String path); 126 public abstract String resolve(String path);
116 127
117 @Override 128 @Override
118 public void dispose() 129 public void dispose()
119 { 130 {
120 this.disposer.dispose(); 131 this.disposer.dispose();
121 } 132 }
122 133
123 private final static class DisposeWrapper implements Disposable 134 private final static class DisposeWrapper implements Disposable
diegocarloslima 2017/04/28 13:23:53 By our code style, the modifier order should be 's
anton 2017/04/28 13:25:35 currently this is made consistent with existing co
124 { 135 {
125 private final long ptr; 136 private final long ptr;
126 137
127 public DisposeWrapper(final long ptr) 138 public DisposeWrapper(final long ptr)
128 { 139 {
129 this.ptr = ptr; 140 this.ptr = ptr;
130 } 141 }
131 142
132 @Override 143 @Override
133 public void dispose() 144 public void dispose()
134 { 145 {
135 dtor(this.ptr); 146 dtor(this.ptr);
136 } 147 }
137 } 148 }
138 149
139 private final static native void registerNatives(); 150 private final static native void registerNatives();
diegocarloslima 2017/04/28 13:23:53 Same here, 'static final'
anton 2017/04/28 13:25:35 currently this is made consistent with existing co
140 151
141 private final static native long ctor(Object callbackObject); 152 private final static native long ctor(Object callbackObject);
diegocarloslima 2017/04/28 13:23:53 Same here, 'static final'
anton 2017/04/28 13:25:35 currently this is made consistent with existing co
142 153
143 private final static native void dtor(long ptr); 154 private final static native void dtor(long ptr);
diegocarloslima 2017/04/28 13:23:53 Same here, 'static final'
anton 2017/04/28 13:25:35 currently this is made consistent with existing co
144 } 155 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld