|
39 | 39 | import java.io.EOFException; |
40 | 40 | import java.io.IOException; |
41 | 41 | import java.io.InputStreamReader; |
| 42 | +import java.util.Date; |
42 | 43 |
|
43 | 44 | import org.scijava.io.location.Location; |
44 | 45 | import org.scijava.plugin.WrapperPlugin; |
@@ -79,6 +80,40 @@ public enum ByteOrder { |
79 | 80 | */ |
80 | 81 | boolean exists() throws IOException; |
81 | 82 |
|
| 83 | + /** |
| 84 | + * Gets the last modified timestamp of the location. |
| 85 | + * |
| 86 | + * @return The last modified timestamp, or null if the handle does not support |
| 87 | + * this feature or if the location does not exist. |
| 88 | + * @throws IOException If something goes wrong with the last modified check. |
| 89 | + */ |
| 90 | + default Date lastModified() throws IOException { |
| 91 | + return null; |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * Gets a "fast" checksum which succinctly represents the contents of the data |
| 96 | + * stream. The term "fast" here refers to the idea that the checksum be |
| 97 | + * retrievable quickly, without actually performing a thorough computation |
| 98 | + * across the entire data stream. Typically, such a thing is feasible because |
| 99 | + * the checksum was calculated a priori; e.g., artifacts deployed to remote |
| 100 | + * Maven repositories are always deployed with corresponding checksum files. |
| 101 | + * <p> |
| 102 | + * No guarantee is made about the exact nature of the checksum (e.g., SHA-1 or |
| 103 | + * MD5), only that the value is deterministic for this particular location |
| 104 | + * with its current contents. In other words: if a checksum differs from a |
| 105 | + * previous inquiry, you can be sure the contents have changed; conversely, if |
| 106 | + * the checksum is still the same, the contents are highly likely to be |
| 107 | + * unchanged. |
| 108 | + * </p> |
| 109 | + * |
| 110 | + * @return The checksum, or null if the handle does not support this feature. |
| 111 | + * @throws IOException If something goes wrong when accessing the checksum. |
| 112 | + */ |
| 113 | + default String checksum() throws IOException { |
| 114 | + return null; |
| 115 | + } |
| 116 | + |
82 | 117 | /** Returns the current offset in the stream. */ |
83 | 118 | long offset() throws IOException; |
84 | 119 |
|
|
0 commit comments