1.字节流指的是InputStream和OutputStream
2.字符流指的是InputStreamReader和OutputStreamWriter
3.请求网络,输入输出均为字节流,最后把输出的字节流转换为字符流
4.URLEncoder是把除ASCII以外的特殊字符进行编码,需要指定编码格式
“=”编译为“%3D”
try {
String str = URLEncoder.encode("=我是很","GBK");
Log.e("LS","URl_Encode--编码---"+str );
String str2 = URLDecoder.decode("%3D%CE%D2%CA%C7%BA%DC","GBK");
Log.e("LS","URl_Encode---解码--"+str2 );
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
5.Base64是把字节码转换为字符串,常用于把图片的字节码转换为字符串
可以打印出来“=”
String str = Base64.encodeToString("=你好".getBytes(),Base64.DEFAULT);
Log.e("LS","base64--编码---"+str );
String str2 = new String(Base64.decode("5L2g5aW9",Base64.DEFAULT));
Log.e("LS","base64--解码---"+str2 );