@SuppressWarnings("nls")
	public void write(File file) {
		try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(file)))) {
			mOut = out;
			mDepth = 0;
			mOut.println("<?xml version=\"1.0\" ?>");
			mOut.println("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
			mOut.println("<plist version=\"1.0\">");
			mDepth++;
			startDictionary();
			emitKeyValue("CFBundleDevelopmentRegion", "English");
			emitKeyValue("CFBundleExecutable", mExecutableName);
			emitKeyValue("CFBundleIconFile", "app.icns");
			emitKeyValue("CFBundleIdentifier", mId);
			emitKeyValue("CFBundleName", mName);
			emitKeyValue("CFBundleInfoDictionaryVersion", "6.0");
			emitKeyValue("CFBundlePackageType", "APPL");
			emitKeyValue("CFBundleShortVersionString", Version.toString(mVersion, false));
			emitKeyValue("CFBundleVersion", Version.toString(mVersion, true));
			emitKeyValue("CFBundleSignature", mSignature);
			emitKeyValue("LSApplicationCategoryType", mCategory);
			emitKeyValues("LSArchitecturePriority", "x86_64", "i386");
			emitKey("LSEnvironment");
			startDictionary();
			emitKeyValue("LC_CTYPE", "UTF-8");
			endDictionary();
			emitKeyValue("LSMinimumSystemVersion", "10.7.0");
			emitKeyValue("NSHumanReadableCopyright", getCopyrightBanner());
			emitKeyValue("NSHighResolutionCapable", true);
			emitKeyValue("NSSupportsAutomaticGraphicsSwitching", true);
			FileType[] openable = FileType.getOpenable();
			if (openable.length > 0) {
				emitKey("CFBundleDocumentTypes");
				startArray();
				for (FileType type : openable) {
					startDictionary();
					emitKeyValue("CFBundleTypeName", type.getDescription());
					String extension = type.getExtension();
					emitKeyValue("CFBundleTypeIconFile", extension + ".icns");
					emitKeyValue("CFBundleTypeRole", "Editor");
					emitKeyValue("LSHandlerRank", "Owner");
					emitKeyValues("LSItemContentTypes", mId + "." + extension);
					endDictionary();
				}
				endArray();
				emitKey("UTExportedTypeDeclarations");
				startArray();
				for (FileType type : openable) {
					startDictionary();
					String extension = type.getExtension();
					emitKeyValue("UTTypeIdentifier", mId + "." + extension);
					emitKeyValue("UTTypeReferenceURL", type.getReferenceURL());
					emitKeyValue("UTTypeDescription", type.getDescription());
					emitKeyValue("UTTypeIconFile", extension + ".icns");
					emitKeyValues("UTTypeConformsTo", "public.xml", "public.data");
					emitKey("UTTypeTagSpecification");
					startDictionary();
					emitKeyValue("com.apple.ostype", "." + extension);
					emitKeyValues("public.filename-extension", extension);
					emitKeyValue("public.mime-type", "application/" + mExecutableName + "." + extension);
					endDictionary();
					endDictionary();
				}
				endArray();
			}
			endDictionary();
			mDepth--;
			mOut.println("</plist>");
			mOut.flush();
		} catch (Exception exception) {
			Log.error(exception);
		}
	}