本文整理汇总了C#中OutputStream.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# OutputStream.Flush方法的具体用法?C# OutputStream.Flush怎么用?C# OutputStream.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputStream
的用法示例。
在下文中一共展示了OutputStream.Flush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onSerialize
public override void onSerialize(OutputStream stream)
{
string json = JsonHelper.ToJson<MyOutput>(this);
byte[] data = Encoding.Default.GetBytes(json);
stream.Write(data, 0, data.Length);
stream.Flush();
}
示例2: _get
//.........这里部分代码省略.........
if (type == SSH_FXP_STATUS)
{
int i = buf.getInt();
throwStatusError(buf, i);
}
byte[] handle = buf.getString(); // filename
long offset = 0;
if (mode == RESUME)
{
offset += skip;
}
int request_len = 0;
while (true)
{
request_len = buf.buffer.Length - 13;
if (server_version == 0)
{
request_len = 1024;
}
sendREAD(handle, offset, request_len);
_header = header(buf, _header);
length = _header.length;
type = _header.type;
int i;
if (type == SSH_FXP_STATUS)
{
buf.rewind();
fill(buf.buffer, 0, length);
i = buf.getInt();
if (i == SSH_FX_EOF)
{
goto BREAK;
}
throwStatusError(buf, i);
}
if (type != SSH_FXP_DATA)
{
goto BREAK;
}
buf.rewind();
fill(buf.buffer, 0, 4);
length -= 4;
i = buf.getInt(); // length of data
int foo = i;
while (foo > 0)
{
int bar = foo;
if (bar > buf.buffer.Length)
{
bar = buf.buffer.Length;
}
i = io.ins.read(buf.buffer, 0, bar);
if (i < 0)
{
goto BREAK;
}
int data_len = i;
dst.Write(buf.buffer, 0, data_len);
offset += data_len;
foo -= data_len;
if (monitor != null)
{
if (!monitor.count(data_len))
{
while (foo > 0)
{
i = io.ins.read(buf.buffer,
0,
(buf.buffer.Length < foo ? buf.buffer.Length : foo));
if (i <= 0) break;
foo -= i;
}
goto BREAK;
}
}
}
}
BREAK:
dst.Flush();
if (monitor != null) monitor.end();
_sendCLOSE(handle, _header);
}
catch (Exception e)
{
//System.Console.WriteLine(e);
if (e is SftpException) throw (SftpException)e;
throw new SftpException(SSH_FX_FAILURE, "");
}
}