docs: private static synchronized FileOutputWriter createFileWriter(final TypeDefinition type, final DecompilerSettings settings)
                  throws IOException
      {
          final String outputDirectory = settings.getOutputDirectory();
  
          final String fileName = type.getName() + settings.getLanguage().getFileExtension();
          final String packageName = type.getPackageName();
  
          // foo.Bar -> foo/Bar.java
          final String subDir = StringUtils.defaultIfEmpty(packageName, "").replace('.', File.separatorChar);
          final String outputPath = PathHelper.combine(outputDirectory, subDir, fileName);
  
          final File outputFile = new File(outputPath);
          final File parentDir = outputFile.getParentFile();
  
          if (parentDir != null && !parentDir.exists() && !parentDir.mkdirs())
          {
              throw new IllegalStateException("Could not create directory:" + parentDir);
          }
  
          if (!outputFile.exists() && !outputFile.createNewFile())
          {
              throw new IllegalStateException("Could not create output file: " + outputPath);
          }
  
          return new FileOutputWriter(outputFile, settings);
      }