File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/main/java/org/scijava/io/handle Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 3232
3333package org .scijava .io .handle ;
3434
35+ import java .io .IOException ;
36+
3537import org .scijava .io .IOService ;
3638import org .scijava .io .location .Location ;
3739import org .scijava .plugin .WrapperService ;
@@ -63,4 +65,18 @@ default Class<DataHandle<Location>> getPluginType() {
6365 default Class <Location > getType () {
6466 return Location .class ;
6567 }
68+
69+ /**
70+ * Convenience method to test whether it describes an existing file.
71+ *
72+ * @param location the location to test
73+ * @return The result of {@link DataHandle#exists()} on a newly created handle
74+ * on this location
75+ * @throws IOException
76+ */
77+ default boolean exists (final Location location ) throws IOException {
78+ try (DataHandle <Location > handle = create (location )) {
79+ return handle .exists ();
80+ }
81+ }
6682}
You can’t perform that action at this time.
0 commit comments