File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed
src/main/java/org/scijava/io/handle Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ public boolean isWritable() {
6363 return !bytes ().isReadOnly ();
6464 }
6565
66+ @ Override
67+ public boolean exists () {
68+ return true ;
69+ }
70+
6671 @ Override
6772 public long offset () {
6873 return offset ;
Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ public enum ByteOrder {
7171 /** Gets whether writing to this handle is supported. */
7272 boolean isWritable ();
7373
74+ /**
75+ * Tests whether this handle's location actually exists at the source.
76+ *
77+ * @return True if the location exists; false if not.
78+ * @throws IOException If something goes wrong with the existence check.
79+ */
80+ boolean exists () throws IOException ;
81+
7482 /** Returns the current offset in the stream. */
7583 long offset () throws IOException ;
7684
Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ public boolean isWritable() {
6363 return true ;
6464 }
6565
66+ @ Override
67+ public boolean exists () {
68+ return true ;
69+ }
70+
6671 @ Override
6772 public long offset () {
6873 return offset ;
@@ -133,5 +138,4 @@ public void close() {
133138 public Class <DummyLocation > getType () {
134139 return DummyLocation .class ;
135140 }
136-
137141}
Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ public boolean isWritable() {
8484 return getMode ().contains ("w" );
8585 }
8686
87+ @ Override
88+ public boolean exists () {
89+ return get ().getFile ().exists ();
90+ }
91+
8792 @ Override
8893 public long offset () throws IOException {
8994 return raf ().getFilePointer ();
@@ -299,5 +304,4 @@ private synchronized void initRAF() throws IOException {
299304 if (raf != null ) return ;
300305 raf = new RandomAccessFile (get ().getFile (), getMode ());
301306 }
302-
303307}
You can’t perform that action at this time.
0 commit comments