Simplify the getter of Crcs

This commit is contained in:
CharlesVaneenoo
2016-02-25 16:58:41 +01:00
parent 6779a3983d
commit b2c0d94db1
+2 -4
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. * @throws IOException If there is an error accessing files to create the table.
*/ */
public int[] getCrcs() throws IOException { public int[] getCrcs() throws IOException {
if (crcs != null) { if (crcs == null) {
return crcs;
}
ByteBuffer buffer = getCrcTable(); ByteBuffer buffer = getCrcTable();
crcs = new int[(buffer.remaining() / Integer.BYTES) - 1]; crcs = new int[(buffer.remaining() / Integer.BYTES) - 1];
Arrays.setAll(crcs, crc -> buffer.getInt()); Arrays.setAll(crcs, crc -> buffer.getInt());
}
return crcs; return crcs;
} }