@Test void testReadingChannelThrows() throws IOException { when(fc.read(any(ByteBuffer.class), anyLong())).thenThrow(IOException.class); assertThrows(HdfException.class, () -> hdfFc.readBufferFromAddress(3, 4)); }
public ByteBuffer readBufferFromAddress(long address, int length) { ByteBuffer bb = ByteBuffer.allocate(length); try { fc.read(bb, address + sb.getBaseAddressByte()); } catch (IOException e) { throw new HdfException( "Failed to read from file at address '" + address + "' (raw address '" + address + sb.getBaseAddressByte() + "'", e); } bb.order(LITTLE_ENDIAN); bb.rewind(); return bb; }
HdfFileChannel { public ByteBuffer readBufferFromAddress(long address, int length) { ByteBuffer bb = ByteBuffer.allocate(length); try { fc.read(bb, address + sb.getBaseAddressByte()); } catch (IOException e) { throw new HdfException( "Failed to read from file at address '" + address + "' (raw address '" + address + sb.getBaseAddressByte() + "'", e); } bb.order(LITTLE_ENDIAN); bb.rewind(); return bb; } }
HdfFileChannel { public ByteBuffer readBufferFromAddress(long address, int length) { ByteBuffer bb = ByteBuffer.allocate(length); try { fc.read(bb, address + sb.getBaseAddressByte()); } catch (IOException e) { throw new HdfException( "Failed to read from file at address '" + address + "' (raw address '" + address + sb.getBaseAddressByte() + "'", e); } bb.order(LITTLE_ENDIAN); bb.rewind(); return bb; } HdfFileChannel(FileChannel fileChannel, Superblock superblock); }
HdfFileChannel { public ByteBuffer readBufferFromAddress(long address, int length) { ByteBuffer bb = ByteBuffer.allocate(length); try { fc.read(bb, address + sb.getBaseAddressByte()); } catch (IOException e) { throw new HdfException( "Failed to read from file at address '" + address + "' (raw address '" + address + sb.getBaseAddressByte() + "'", e); } bb.order(LITTLE_ENDIAN); bb.rewind(); return bb; } HdfFileChannel(FileChannel fileChannel, Superblock superblock); ByteBuffer readBufferFromAddress(long address, int length); ByteBuffer map(long address, long length); ByteBuffer mapNoOffset(long address, long length); long getUserBlockSize(); Superblock getSuperblock(); FileChannel getFileChannel(); int getSizeOfOffsets(); int getSizeOfLengths(); final void close(); long size(); }
HdfFileChannel { public ByteBuffer readBufferFromAddress(long address, int length) { ByteBuffer bb = ByteBuffer.allocate(length); try { fc.read(bb, address + sb.getBaseAddressByte()); } catch (IOException e) { throw new HdfException( "Failed to read from file at address '" + address + "' (raw address '" + address + sb.getBaseAddressByte() + "'", e); } bb.order(LITTLE_ENDIAN); bb.rewind(); return bb; } HdfFileChannel(FileChannel fileChannel, Superblock superblock); ByteBuffer readBufferFromAddress(long address, int length); ByteBuffer map(long address, long length); ByteBuffer mapNoOffset(long address, long length); long getUserBlockSize(); Superblock getSuperblock(); FileChannel getFileChannel(); int getSizeOfOffsets(); int getSizeOfLengths(); final void close(); long size();  }