本文整理汇总了C#中Writer.flush方法的典型用法代码示例。如果您正苦于以下问题:C# Writer.flush方法的具体用法?C# Writer.flush怎么用?C# Writer.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Writer
的用法示例。
在下文中一共展示了Writer.flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: writeHeader
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public static VCFHeader writeHeader(VCFHeader header, final Writer writer, final boolean doNotWriteGenotypes, final String versionLine, final String streamNameForError)
public static VCFHeader writeHeader(VCFHeader header, Writer writer, bool doNotWriteGenotypes, string versionLine, string streamNameForError)
{
header = doNotWriteGenotypes ? new VCFHeader(header.MetaDataInSortedOrder) : header;
try
{
// the file format field needs to be written first
writer.write(versionLine + "\n");
foreach (VCFHeaderLine line in header.MetaDataInSortedOrder)
{
if (VCFHeaderVersion.isFormatString(line.Key))
{
continue;
}
writer.write(VCFHeader.METADATA_INDICATOR);
writer.write(line.ToString());
writer.write("\n");
}
// write out the column line
writer.write(VCFHeader.HEADER_INDICATOR);
bool isFirst = true;
foreach (string field in VCFHeader.HEADER_FIELDS)
{
if (isFirst)
{
isFirst = false; // don't write out a field separator
}
else
{
writer.write(VCFConstants.FIELD_SEPARATOR);
}
writer.write(field.ToString());
}
if (header.hasGenotypingData())
{
writer.write(VCFConstants.FIELD_SEPARATOR);
writer.write("FORMAT");
foreach (string sample in header.GenotypeSampleNames)
{
writer.write(VCFConstants.FIELD_SEPARATOR);
writer.write(sample);
}
}
writer.write("\n");
writer.flush(); // necessary so that writing to an output stream will work
}
catch (IOException e)
{
throw new Exception("IOException writing the VCF header to " + streamNameForError, e);
}
return header;
}