code: private OptionalHeader loadOptionalHeader(PESignature pesig,
              COFFFileHeader coff, RandomAccessFile raf) throws IOException {
          // offset right after the eCOFF File Header
          long offset = pesig.getOffset() + PESignature.PE_SIG.length
                  + COFFFileHeader.HEADER_SIZE;
          logger.info("Optional Header offset: " + offset);
          // set the maximum size for the bytes to read
          int size = getOptHeaderSize(offset);
          // read bytes and construct header
          byte[] headerbytes = loadBytesSafely(offset, size, raf);
          return OptionalHeader.newInstance(headerbytes, offset);
      }
docs: Loads the optional header. Presumes a valid PE file.
  
  @param pesig
  pe signature
  @param coff
  coff file header
  @param raf
  the random access file instance
  @return optional header
  @throws IOException
  if unable to read header