(Path path)
| 128 | } |
| 129 | |
| 130 | public byte[] hash(Path path) throws IOException { |
| 131 | TlData tlData = tlDatas.get(); |
| 132 | |
| 133 | MessageDigest digest = tlData.digests.get(this); |
| 134 | ByteBuffer buffer = tlData.buffer; |
| 135 | buffer.clear(); |
| 136 | |
| 137 | try (SeekableByteChannel channel = Files.newByteChannel(path)) { |
| 138 | while (channel.read(buffer) != -1) { |
| 139 | buffer.flip(); |
| 140 | digest.update(buffer); |
| 141 | buffer.clear(); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | return digest.digest(); |
| 146 | } |
| 147 | |
| 148 | private static class TlData { |
| 149 | TlData() { |