Write map of sets to a file.

<p>The serialization format is XML properties format where values are comma
separated lists.</p>

@param m map to serialize
@param outputFile output filename, relative to temporary directory
495325
public static void writeMapToXML(final Map<URI, Set<URI>> m, final File outputFile) throws IOException {
        if (m == null) {
            return;
        }
        final Properties prop = new Properties();
        for (final Map.Entry<URI, Set<URI>> entry: m.entrySet()) {
            final URI key = entry.getKey();
            final String value = StringUtils.join(entry.getValue(), COMMA);
            prop.setProperty(key.getPath(), value);
        }
        try (OutputStream os = new FileOutputStream(outputFile)) {
            prop.storeToXML(os, null);
        } catch (final IOException e) {
            throw new IOException("Failed to write subject scheme graph: " + e.getMessage(), e);
        }
    }
1295073
public static void write(IDataSet dataSet, OutputStream out) throws IOException, DataSetException {
		logger.debug("write(dataSet={}, out={}) - start", dataSet, out);

		FlatXmlWriter datasetWriter = new FlatXmlWriter(out);
		datasetWriter.setIncludeEmptyTable(true);
		datasetWriter.write(dataSet);
	}
1285267
public void serialize(final OutputStream out) throws IOException {
    final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
    this.seqModel.serialize(out);
    writer.flush();
  }
491791
def _writeMzmlChecksum(xmlWriter, outputFile):
    
    sha = hashlib.sha1(outputFile.getvalue())
    sha.update('<fileChecksum>')

    xmlChecksumElement = ETREE.Element('fileChecksum')
    xmlChecksumElement.text = sha.hexdigest()

    xmlWriter.write(xmlChecksumElement, pretty_print=True)
1125929
public void setOutputfile(String outputfile) {
	try {
	    this.outputfile = ResourceUtil.toResourceExistingParent(pageContext, outputfile);
	    pageContext.getConfig().getSecurityManager().checkFileLocation(this.outputfile);

	}
	catch (PageException e) {
	    this.outputfile = pageContext.getConfig().getTempDirectory().getRealResource(outputfile);
	    if (!this.outputfile.getParentResource().exists()) this.outputfile = null;
	    else if (!this.outputfile.isFile()) this.outputfile = null;
	    else if (!this.outputfile.exists()) {
		ResourceUtil.createFileEL(this.outputfile, false);
		// try {
		// this.outputfile.createNewFile();
		/*
		 * } catch (IOException e1) { this.outputfile=null; }
		 */
	    }
	}
    }
1025778
static <K, V> void writeTo(CodedOutputStream output, Metadata<K, V> metadata, K key, V value) throws IOException {
        CodedConstant.writeElement(output, metadata.keyType, KEY_FIELD_NUMBER, key);
        CodedConstant.writeElement(output, metadata.valueType, VALUE_FIELD_NUMBER, value);
    }
993765
@Override
	public <E> void serializeCollection(Collection<E> collection, Class<E> objectClazz, File output) {
		if (collection == null)
			return;

		try (SerializerWrapper serializer = createSerializer(output)) {
			mapperFor(objectClazz).serializeCollection(this, serializer, collection);
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}
	}
889916
@Override
    public void writeXML(@WillClose XMLOutput xmlOutput) throws IOException {
        assert project != null;
        try {
            writePrologue(xmlOutput);
            if (withMessages) {
                computeBugHashes();
                getProjectStats().computeFileStats(this);
                String commonBase = null;
                for (String s : project.getSourceDirList()) {
                    if (commonBase == null) {
                        commonBase = s;
                    } else {
                        commonBase = commonBase.substring(0, commonPrefix(commonBase, s));
                    }

                }
                if (commonBase != null && commonBase.length() > 0) {
                    if (commonBase.indexOf("/./") > 0) {
                        commonBase = commonBase.substring(0, commonBase.indexOf("/."));
                    }
                    File base = new File(commonBase);
                    if (base.exists() && base.isDirectory() && base.canRead()) {
                        SourceLineAnnotation.generateRelativeSource(base, project);
                    }
                }
            }
            if (earlyStats && !minimalXML) {
                getProjectStats().writeXML(xmlOutput, withMessages);
            }

            // Write BugInstances
            for (BugInstance bugInstance : getCollection()) {
                if (!applySuppressions || !project.getSuppressionFilter().match(bugInstance)) {
                    bugInstance.writeXML(xmlOutput, this, withMessages);
                }
            }

            writeEpilogue(xmlOutput);

        } finally {
            xmlOutput.finish();
            SourceLineAnnotation.clearGenerateRelativeSource();
        }
    }
494607
public FileObject write(ClassSymbol c) throws IOException {
        String className = c.flatName().toString();
        Location outLocn;
        if (multiModuleMode) {
            ModuleSymbol msym = c.owner.kind == MDL ? (ModuleSymbol) c.owner : c.packge().modle;
            outLocn = fileManager.getLocationForModule(StandardLocation.NATIVE_HEADER_OUTPUT, msym.name.toString());
        } else {
            outLocn = StandardLocation.NATIVE_HEADER_OUTPUT;
        }
        FileObject outFile
            = fileManager.getFileForOutput(outLocn,
                "", className.replaceAll("[.$]", "_") + ".h", null);
        PrintWriter out = new PrintWriter(outFile.openWriter());
        try {
            write(out, c);
            if (verbose)
                log.printVerbose("wrote.file", outFile);
            out.close();
            out = null;
        } finally {
            if (out != null) {
                // if we are propogating an exception, delete the file
                out.close();
                outFile.delete();
                outFile = null;
            }
        }
        return outFile; // may be null if write failed
    }
292410
public static File writeMap(Map<?, ?> map, File file, Charset charset, String kvSeparator, boolean isAppend) throws IORuntimeException {
		return FileWriter.create(file, charset).writeMap(map, kvSeparator, isAppend);
	}
1123396
public static void write(final String data, final OutputStream output) throws IOException {
		if (data != null) {
			output.write(data.getBytes(Charsets.UTF_8));
		}
	}
1202508
public static void writeXml(Serializable serializable, OutputStream output) throws IOException {
		TransportFormat.XML.writeSerializableTo(serializable, output);
	}
309474
private void serializeMap(Map<?,?> map, File file) {
        try(ObjectOutputStream os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))){
            os.writeObject(map);
        } catch (Exception e) {
            logger.error(e.getLocalizedMessage(), e);
        }
    }
543781
public static void writeGen(JavaFileObject fileObject, JsonModelModel model)
			throws IOException {
		MvelTemplate.writeGen(fileObject, model);
	}
322185
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator)
  throws IOException {
    XMLOutputter outputter = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    format.setEncoding(encoding);
    format.setIndent(indent);
    format.setLineSeparator(lineSeparator);
    outputter.setFormat(format);
    outputter.output(getDocument(), outputStream);
  }
1280715
private static void writeStringMap(SymbolTable map, ObjectOutput out)
      throws IOException {
    out.writeInt(map.size());
    for (ObjectIntCursor<String> cursor : map) {
      out.writeUTF(cursor.key);
      out.writeInt(cursor.value);
    }
  }
101392
public void writeDocument(OutputStream os, MediaType mt, Document document) {
        ProvFormat format = mimeTypeRevMap.get(mt.toString());
        writeDocument(os, format, document);
    }