@@ -106,7 +106,7 @@ public JSONObject makeEntryForFile(File file) {
106106 }
107107
108108 abstract JSONObject getFileForLocalURL (LocalFilesystemURL inputURL , String path ,
109- JSONObject options , boolean directory ) throws FileExistsException , IOException , TypeMismatchException , EncodingException , JSONException ;
109+ JSONObject options , boolean directory ) throws FileExistsException , IOException , TypeMismatchException , EncodingException , JSONException ;
110110
111111 abstract boolean removeFileAtLocalURL (LocalFilesystemURL inputURL ) throws InvalidModificationException , NoModificationAllowedException ;
112112
@@ -174,13 +174,13 @@ protected static String normalizePath(String rawPath) {
174174 if (components .get (index ).equals (".." )) {
175175 components .remove (index );
176176 if (index > 0 ) {
177- components .remove (index - 1 );
177+ components .remove (index - 1 );
178178 --index ;
179179 }
180180 }
181181 }
182182 StringBuilder normalizedPath = new StringBuilder ();
183- for (String component : components ) {
183+ for (String component : components ) {
184184 normalizedPath .append ("/" );
185185 normalizedPath .append (component );
186186 }
@@ -200,6 +200,7 @@ public long getFreeSpaceInBytes() {
200200 }
201201
202202 public abstract Uri toNativeUri (LocalFilesystemURL inputURL );
203+
203204 public abstract LocalFilesystemURL toLocalUri (Uri inputURL );
204205
205206 public JSONObject getRootEntry () {
@@ -221,7 +222,7 @@ public JSONObject getParentForLocalURL(LocalFilesystemURL inputURL) throws IOExc
221222 protected LocalFilesystemURL makeDestinationURL (String newName , LocalFilesystemURL srcURL , LocalFilesystemURL destURL , boolean isDirectory ) {
222223 // I know this looks weird but it is to work around a JSON bug.
223224 if ("null" .equals (newName ) || "" .equals (newName )) {
224- newName = srcURL .uri .getLastPathSegment ();;
225+ newName = srcURL .uri .getLastPathSegment ();
225226 }
226227
227228 String newDest = destURL .uri .toString ();
@@ -242,7 +243,7 @@ protected LocalFilesystemURL makeDestinationURL(String newName, LocalFilesystemU
242243 * or remove the source file when finished.
243244 */
244245 public JSONObject copyFileToURL (LocalFilesystemURL destURL , String newName ,
245- Filesystem srcFs , LocalFilesystemURL srcURL , boolean move ) throws IOException , InvalidModificationException , JSONException , NoModificationAllowedException , FileExistsException {
246+ Filesystem srcFs , LocalFilesystemURL srcURL , boolean move ) throws IOException , InvalidModificationException , JSONException , NoModificationAllowedException , FileExistsException {
246247 // First, check to see that we can do it
247248 if (move && !srcFs .canRemoveFileAtLocalURL (srcURL )) {
248249 throw new NoModificationAllowedException ("Cannot move file at source URL" );
@@ -294,7 +295,7 @@ public void readFileAtURL(LocalFilesystemURL inputURL, long start, long end,
294295 }
295296
296297 abstract long writeToFileAtURL (LocalFilesystemURL inputURL , String data , int offset ,
297- boolean isBinary ) throws NoModificationAllowedException , IOException ;
298+ boolean isBinary ) throws NoModificationAllowedException , IOException ;
298299
299300 abstract long truncateFileAtURL (LocalFilesystemURL inputURL , long size )
300301 throws IOException , NoModificationAllowedException ;
@@ -308,10 +309,12 @@ abstract long truncateFileAtURL(LocalFilesystemURL inputURL, long size)
308309
309310 protected class LimitedInputStream extends FilterInputStream {
310311 long numBytesToRead ;
312+
311313 public LimitedInputStream (InputStream in , long numBytesToRead ) {
312314 super (in );
313315 this .numBytesToRead = numBytesToRead ;
314316 }
317+
315318 @ Override
316319 public int read () throws IOException {
317320 if (numBytesToRead <= 0 ) {
@@ -320,14 +323,15 @@ public int read() throws IOException {
320323 numBytesToRead --;
321324 return in .read ();
322325 }
326+
323327 @ Override
324328 public int read (byte [] buffer , int byteOffset , int byteCount ) throws IOException {
325329 if (numBytesToRead <= 0 ) {
326330 return -1 ;
327331 }
328332 int bytesToRead = byteCount ;
329333 if (byteCount > numBytesToRead ) {
330- bytesToRead = (int )numBytesToRead ; // Cast okay; long is less than int here.
334+ bytesToRead = (int ) numBytesToRead ; // Cast okay; long is less than int here.
331335 }
332336 int numBytesRead = in .read (buffer , byteOffset , bytesToRead );
333337 numBytesToRead -= numBytesRead ;
@@ -341,8 +345,8 @@ protected Uri.Builder createLocalUriBuilder() {
341345 String path = LocalFilesystemURL .fsNameToCdvKeyword (name );
342346
343347 return new Uri .Builder ()
344- .scheme (scheme )
345- .authority (hostname )
346- .path (path );
348+ .scheme (scheme )
349+ .authority (hostname )
350+ .path (path );
347351 }
348352}
0 commit comments