private void loadSectionBytes() throws IOException {
        Preconditions.checkState(size == (int) size,
                "section is too large to dump into byte array");
        try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
            raf.seek(offset);
            byte[] bytes = new byte[(int) size];
            raf.read(bytes);
            sectionbytes = Optional.of(bytes);
        }
    }
private void loadSectionBytes ( ) throws IOException { Preconditions . checkState ( size == ( int ) size , "section is too large to dump into byte array" ) ; try ( RandomAccessFile raf = new RandomAccessFile ( file , "r" ) ) { raf . seek ( offset ) ; byte [ ] bytes = new byte [ ( int ) size ] ; raf . read ( bytes ) ; sectionbytes = Optional . of ( bytes ) ; } }
Loads the section bytes from the file using offset and size.

@throws IOException
if file can not be read
@throws IllegalStateException
if section is too large to fit into a byte array. This
happens if the size is larger than int can hold.