ZlibѹËõËã·¨ÔÚjavaÉϵÄÓ¦ÓÃ
JAVAʵÏÖ
¡¡¡¡ÔÚJDKÖУ¬ÔÚjava.util.zip°üÖÐÒѾÄÚÖÃÁËZLIBµÄʵÏÖ£¬Ê¾Àý´úÂëÈçÏ£º
1//½âѹ
2 public String decompressData(String encdata) {
3 try {
4 ByteArrayOutputStream bos = new ByteArrayOutputStream();
5 InflaterOutputStream zos = new InflaterOutputStream(bos);
6 zos.write(convertfromBase64(encdata));
7 zos.close();
8 return new String(bos.toByteArray());
9 } catch (Exception ex) {
10 ex.printStackTrace();
11 return "UNZIP_ERR";
12 }
13 }
14
15 //ѹËõ
16 public String compressData(String data) {
17 try {
18 ByteArrayOutputStream bos = new ByteArrayOutputStream();
19 DeflaterOutputStream zos = new DeflaterOutputStream(bos);
20 zos.write(data.getBytes());
21 zos.close();
22 return new String(convertToBase64(bos.toByteArray()));
23 } catch (Exception ex) {
24 ex.printStackTrace();
25 return "ZIP_ERR";
26 }
27 }
²»¹ýÎÒAndroidÀïÃæInflaterOutputStreamºÃÏñ²»Ö§³Ö ÎÒ»¹Ã»Ïëµ½ÈçºÎÔÚandroidÀïʵÏÖ
Ïà¹ØÎĵµ£º
Êý¾Ý¿â±íµ¥µÄ´´½¨
mysql> create database shuishengmu;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql & ......
ij֪ÃûÃÅ»§ÍøÕ¾µÄÒ»µÀ±ÊÊÔÌâ
public class Test {
public static void stringUpd(String str) {
str = str.replace("j", "l");
System.out.println(str);
}
public static void stringBufferUpd(StringBuffer bf) {
bf.append("c");
System.out.println(bf);
}
......
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet. ......
Java
»ù´¡·½Ãæ
:
1
¡¢
char
ÐͱäÁ¿ÖÐÄܲ»ÄÜ´æÖüÒ»¸öÖÐÎĺº×Ö
?
Ϊʲô
?
´ð£º
ÊÇÄܹ»¶¨Òå³ÉΪһ¸öÖÐÎĵģ¬ÒòΪjavaÖÐÒÔunicode±àÂ룬һ¸öcharÕ¼16×Ö½Ú£¬ËùÒÔ·ÅÒ»¸öÖÐÎÄÊÇûÎÊÌâµÄ
2:
À¬»ø»ØÊÕ»úÖÆ
,
ÈçºÎÓÅ»¯³ÌÐò
?
A:javaÖеÄÀ¬»øÊÕ¼¯
£¨Garbage Collection,GC£©ÓÃÀ´»ØÊÕÄÇЩ¹ýÈ¥·ÖÅäµÄ²»ÔÙÓ ......