十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
string url = "" + "senderLoginName=" + "zy" + "token=" + "997a7cdc-2399-47e8-991e-96c859cccc7f";
创新互联主要从事成都网站建设、成都网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务青浦,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
req.Method = "POST";
byte[] fileData = null;
using (FileStream fs = new FileStream("c:\\LDAP集成设计文档.doc", FileMode.Open))
{
fileData = new byte[fs.Length];
fs.Read(fileData, 0, (int)fs.Length);
}
string BOUNDARY = "---------------------------7d4a6d158c9";
string fileName = "LDAP集成设计文档.doc";
StringBuilder sb = new StringBuilder();
sb.Append("--");
sb.Append(BOUNDARY);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data;\r\n name=\"1\"; filename=\"" + fileName + "\"\r\n");
sb.Append("Content-Type: application/msword\r\n\r\n");
req.Headers.Add("Content-Type", "multipart/form-data;boundary=" + BOUNDARY);
Listbyte sendData = new Listbyte();
sendData.AddRange(Encoding.UTF8.GetBytes(sb.ToString()));
sendData.AddRange(fileData);
sendData.AddRange(Encoding.UTF8.GetBytes("\r\n--" + BOUNDARY + "--\r\n"));
req.ContentLength = sendData.Count;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(sendData.ToArray(), 0, sendData.Count);
}
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
using (Stream respStream = resp.GetResponseStream())
using (FileStream fs = new FileStream("c:\\test.txt", FileMode.Truncate))
{
int ch = 0;
while ((ch = respStream.ReadByte()) != -1)
{
fs.WriteByte((byte)ch);
}
}
根据你的java代码转换的。
public class Test {
public static void main(String[] args) {
//定义用户组
Group group = new Group();
//设置用户组信息
group.setId(0L);
group.setName("admin");
//定义2个用户:guest和root,并设置相关用户信息
User guestUser = new User();
guestUser.setId(2L);
guestUser.setName("guest");
User rootUser = new User();
rootUser.setId(3L);
rootUser.setName("root");
//getUsers获取用户组中的所有用户集合,通过add方法向用户集合中添加新用户
group.getUsers().add(guestUser);
group.getUsers().add(rootUser);
}
}
String array[] = { a, b, c };
String a[] = new String[3];
for( int i = array.length-1; i = 0 ; i-- ) {
a[array.length-1-i] = array[i];
}
或者你可以用StringBuffer里面的reverse, "new StringBuilder(aaaaa).reverse().toString()"