URL httpurl;
String str = "username=中国";
String url = "http://127.0.0.1:8080/login.do";
try {
str = URLEncoder.encode(str, "utf-8");
// 如有中文一定要加上,在接收方用相应字符转码即可
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
String str = "username=中国";
String url = "http://127.0.0.1:8080/login.do";
try {
str = URLEncoder.encode(str, "utf-8");
// 如有中文一定要加上,在接收方用相应字符转码即可
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Tags: HttpURLConnection
InputStream fs=fi.getInputStream();
int b;
//顺序读取文件text里的内容并赋值给整型变量b,直到文件结束为止。
StringBuffer sb=new StringBuffer();
while((b=fs.read())!=-1 ){
if((char)b=='\n'){
sb.append("回车");
}else{
sb.append((char)b);
int b;
//顺序读取文件text里的内容并赋值给整型变量b,直到文件结束为止。
StringBuffer sb=new StringBuffer();
while((b=fs.read())!=-1 ){
if((char)b=='\n'){
sb.append("回车");
}else{
sb.append((char)b);
Tags: InputStream