本文整理汇总了C#中System.IO.MemoryStream.reset方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.MemoryStream.reset方法的具体用法?C# System.IO.MemoryStream.reset怎么用?C# System.IO.MemoryStream.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.MemoryStream
的用法示例。
在下文中一共展示了System.IO.MemoryStream.reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: encode
public static System.String encode(System.String s, System.String enc)
{
if (!needsEncoding(s))
{
return s;
}
int length = s.Length;
System.Text.StringBuilder out_Renamed = new System.Text.StringBuilder(length);
System.IO.MemoryStream buf = new System.IO.MemoryStream(10); // why 10? w3c says so.
//UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'"
//UPGRADE_TODO: Constructor 'java.io.OutputStreamWriter.OutputStreamWriter' was converted to 'System.IO.StreamWriter.StreamWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioOutputStreamWriterOutputStreamWriter_javaioOutputStream_javalangString'"
System.IO.StreamWriter writer = new System.IO.StreamWriter(new System.IO.StreamWriter(buf, System.Text.Encoding.GetEncoding(enc)).BaseStream, new System.IO.StreamWriter(buf, System.Text.Encoding.GetEncoding(enc)).Encoding);
for (int i = 0; i < length; i++)
{
int c = (int) s[i];
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == ' ')
{
if (c == ' ')
{
c = '+';
}
toHex(out_Renamed, SupportClass.ToSByteArray(buf.ToArray()));
//UPGRADE_ISSUE: Method 'java.io.ByteArrayOutputStream.reset' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaioByteArrayOutputStreamreset'"
buf.reset();
out_Renamed.Append((char) c);
}
else
{
try
{
writer.Write((System.Char) c);
if (c >= 0xD800 && c <= 0xDBFF && i < length - 1)
{
int d = (int) s[i + 1];
if (d >= 0xDC00 && d <= 0xDFFF)
{
writer.Write((System.Char) d);
i++;
}
}
writer.Flush();
}
catch (System.IO.IOException ex)
{
throw new System.ArgumentException(s);
}
}
}
toHex(out_Renamed, SupportClass.ToSByteArray(buf.ToArray()));
return out_Renamed.ToString();
}