Simplify the getter of Crcs

This commit is contained in:
CharlesVaneenoo
2016-02-25 16:58:41 +01:00
parent 6779a3983d
commit b2c0d94db1
+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;
}