Merge pull request #246 from CharlesVaneenoo/simplify-Crcs-getter

Simplify the getter of Crcs
This commit is contained in:
Major
2016-02-26 08:57:33 +00:00
+4 -6
View File
@@ -163,13 +163,11 @@ public final class IndexedFileSystem implements Closeable {
* @throws IOException If there is an error accessing files to create the table.
*/
public int[] getCrcs() throws IOException {
if (crcs != null) {
return crcs;
if (crcs == null) {
ByteBuffer buffer = getCrcTable();
crcs = new int[(buffer.remaining() / Integer.BYTES) - 1];
Arrays.setAll(crcs, crc -> buffer.getInt());
}
ByteBuffer buffer = getCrcTable();
crcs = new int[(buffer.remaining() / Integer.BYTES) - 1];
Arrays.setAll(crcs, crc -> buffer.getInt());
return crcs;
}