code: public Optional<Long> maybeGetFileOffset(long rva) {
          Optional<SectionHeader> section = maybeGetSectionHeaderByRVA(rva);
          // standard value if rva doesn't point into a section
          long fileOffset = rva;
          // rva is located within a section, so calculate offset
          if (section.isPresent()) {
              long virtualAddress = section.get().get(VIRTUAL_ADDRESS);
              long pointerToRawData = section.get().get(POINTER_TO_RAW_DATA);
              fileOffset = rva - (virtualAddress - pointerToRawData);
          }
          // file offset is not within file --> return absent
          if (fileOffset > file.length() || fileOffset < 0) {
          	logger.warn("invalid file offset: 0x"
                      + Long.toHexString(fileOffset) + " for file: "
                      + file.getName() + " with length 0x"
                      + Long.toHexString(file.length()));
              return Optional.absent();
          }
          return Optional.of(fileOffset);
      }
docs: Returns the file offset for the given RVA. Returns absent if file offset
  is not within file.
  
  @param rva
  the relative virtual address that shall be converted to a
  plain file offset
  @return file offset