void loadBlock ( BlockId blockId , ByteBuffer block ) throws IOException { synchronized ( m_accessLock ) { if ( ! m_blockPathMap . containsKey ( blockId ) ) { throw new IllegalArgumentException ( "Request to load block that is not stored: " + blockId ) ; } int origPosition = block . position ( ) ; block . position ( 0 ) ; Path blockPath = m_blockPathMap . get ( blockId ) ; try ( SeekableByteChannel channel = Files . newByteChannel ( blockPath ) ) { channel . read ( block ) ; } finally { block . position ( origPosition ) ; } } }
Read the block with the given ID into the given byte buffer .