code: protected void writeClassToDisk(File targetDir, ClassWriter classWriter, String className) throws IOException {
          if (targetDir != null) {
  
              String fileName = className.replace('.', '/') + ".class";
              File targetFile = new File(targetDir, fileName);
              targetFile.getParentFile().mkdirs();
  
              try (OutputStream outputStream = Files.newOutputStream(targetFile.toPath())) {
                  writeClassToDisk(outputStream, classWriter);
              }
          }
      }
docs: Writes the class file to disk in the given directory.
  
  @param targetDir   The target directory
  @param classWriter The current class writer
  @param className   The class name
  @throws IOException if there is a problem writing the class to disk