@Test void testVerifySuperblockReturnsFalseWhenNotCorrect() { assertThat(Superblock.verifySignature(fc, 3), is(false)); }
static boolean verifySignature(FileChannel fc, long offset) { ByteBuffer signatureBuffer = ByteBuffer.allocate(HDF5_FILE_SIGNATURE_LENGTH); try { fc.read(signatureBuffer, offset); } catch (IOException e) { throw new HdfException("Failed to read from address: " + Utils.toHex(offset), e); } return Arrays.equals(HDF5_FILE_SIGNATURE, signatureBuffer.array()); }
Superblock { static boolean verifySignature(FileChannel fc, long offset) { ByteBuffer signatureBuffer = ByteBuffer.allocate(HDF5_FILE_SIGNATURE_LENGTH); try { fc.read(signatureBuffer, offset); } catch (IOException e) { throw new HdfException("Failed to read from address: " + Utils.toHex(offset), e); } return Arrays.equals(HDF5_FILE_SIGNATURE, signatureBuffer.array()); } }
Superblock { static boolean verifySignature(FileChannel fc, long offset) { ByteBuffer signatureBuffer = ByteBuffer.allocate(HDF5_FILE_SIGNATURE_LENGTH); try { fc.read(signatureBuffer, offset); } catch (IOException e) { throw new HdfException("Failed to read from address: " + Utils.toHex(offset), e); } return Arrays.equals(HDF5_FILE_SIGNATURE, signatureBuffer.array()); }  }
Superblock { static boolean verifySignature(FileChannel fc, long offset) { ByteBuffer signatureBuffer = ByteBuffer.allocate(HDF5_FILE_SIGNATURE_LENGTH); try { fc.read(signatureBuffer, offset); } catch (IOException e) { throw new HdfException("Failed to read from address: " + Utils.toHex(offset), e); } return Arrays.equals(HDF5_FILE_SIGNATURE, signatureBuffer.array()); }  abstract int getVersionOfSuperblock(); abstract int getSizeOfOffsets(); abstract int getSizeOfLengths(); abstract long getBaseAddressByte(); abstract long getEndOfFileAddress(); static Superblock readSuperblock(FileChannel fc, long address); }
Superblock { static boolean verifySignature(FileChannel fc, long offset) { ByteBuffer signatureBuffer = ByteBuffer.allocate(HDF5_FILE_SIGNATURE_LENGTH); try { fc.read(signatureBuffer, offset); } catch (IOException e) { throw new HdfException("Failed to read from address: " + Utils.toHex(offset), e); } return Arrays.equals(HDF5_FILE_SIGNATURE, signatureBuffer.array()); }  abstract int getVersionOfSuperblock(); abstract int getSizeOfOffsets(); abstract int getSizeOfLengths(); abstract long getBaseAddressByte(); abstract long getEndOfFileAddress(); static Superblock readSuperblock(FileChannel fc, long address);  }