日期:2014-05-17  浏览次数:20404 次

一个c#的简单改造语句 问题
Java code

InputStream is = request.getInputStream();
BufferedInputStream buf = new BufferedInputStream(is);
byte[] buffer = new byte[1024];
StringBuffer data = new StringBuffer();
int a;
while ((a = buf.read(buffer)) != -1) {
    data.append(new String(buffer, 0, a, “utf-8”));
}
is.close();



上面一段为 java 代码, 有没有哪个能帮我 改成 c#的代码?

------解决方案--------------------
InputStream is = request.getInputStream();
BufferedInputStream buf = new BufferedInputStream(is);
int[] buffer = new int[1024];
StringBuffer data = new StringBuffer();
int a;
while ((a = buf.read(buffer)) != -1) {
data.append(new String(buffer, 0, a, "utf-8"));
}
this.close();


大部分是一样的,注意引号,要用英文的。上面是用的中文




------解决方案--------------------
二进制转字符串