Skip to content

Commit 42567de

Browse files
committed
DataHandles: Add helper methods for read- / write- only handles
This reduced the amount of repetion in the code
1 parent 8224eeb commit 42567de

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/scijava/io/handle/DataHandles.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ private static synchronized void initUTFMethod() {
112112
"No usable DataOutputStream.writeUTF(String, DataOutput)", exc);
113113
}
114114
}
115+
116+
protected static IOException readOnlyException() {
117+
return new IOException("This handle is read-only!");
118+
}
119+
120+
protected static IOException writeOnlyException() {
121+
return new IOException("This handle is write-only!");
122+
}
123+
115124

116125
/**
117126
* Copies all bytes from the input to the output handle. Reading and writing

0 commit comments

Comments
 (0)