java zip ½âѹËõ
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
public class ZipUtil {
Logger logger = Logger.getLogger(ZipUtil.class.getSimpleName());
/** Constants for mode listing or mode extracting. */
public static final int LIST = 0, EXTRACT = 1;
/** Whether we are extracting or just printing TOC */
protected int mode = LIST;
/** The ZipFile that is used to read an archive */
protected ZipFile zippy;
/** The buffer for reading/writing the ZipFile data */
protected byte[] b;
private String unzipFileTargetLocation;
public ZipUtil() {
b = new byte[8092];
}
/** Set the Mode (list, extract). */
public void setMode(int m) {
if (m == LIST || m == EXTRACT)
mode = m;
}
/** Cache of paths we've mkdir()ed. */
protected SortedSet dirsMade;
/**
* For a given Zip file, process each entry.&nb
Ïà¹ØÎĵµ£º
String str = "ÖÐ";
String str1 = new String(str.getBytes("gbk"), "ISO8859-1");
String str2 = new String(str1.getBytes("ISO8859-1"), "gbk");
System.out.println(str2); //Êä³ö"ÖÐ" ......
String newStr = new String(oldStr.getBytes(), "UTF-8");
javaÖеÄStringÀàÊÇ°´ÕÕunicode½øÐбàÂëµÄ£¬µ±Ê¹ÓÃString(byte[] bytes, String encoding)¹¹Ôì×Ö·û´®Ê±£¬encodingËùÖ¸µÄÊÇbytesÖеÄÊý¾ÝÊÇ°´ÕÕÄÇÖÖ·½Ê½±àÂëµÄ£¬¶ø²»ÊÇ×îºó²úÉúµÄStringÊÇʲô±àÂ뷽ʽ£¬»»¾ä»°Ëµ£¬ÊÇÈÃϵͳ°ÑbytesÖеÄÊý¾ÝÓÉencoding±à ......
¡¡¡¡ÔõôÈóÌÐòÀûÓÃËÑË÷ÒýÇæÀ´ËѼ¯ÍøÖ·£¬ÕâÓÐʲôÓÃ?ºÜÓÐÓÃ!ÍøÉ϶¯éüÓÐÈ˽ÐÂôÍøÖ·Êý¾Ý¿â£¬Èç·¢²¼Èí¼þÍøÖ·¡¢ÓʼþµØÖ·¡¢ÂÛ̳ÍøÖ·¡¢ÐÐÒµÍøÖ·£¬ÕâЩÍøÖ·ÊÇÔõôÀ´µÄÄØ?²»¿ÉÄÜÊÇÈËÊÖ¹¤ÊÕ¼¯¶øÀ´µÄ£¬¶¼ÊÇÈóÌÐòÀûÓÃËÑË÷ÒýÇæÈ¡µ½µÄ£¬Èç¹ûÄúÐèҪijÀàÍøÖ·ÐÅÏ¢Êý¾Ý£¬¾Í¸ú³É¶¼ÀÊÎÖ½ÌÓýÀ´Ò»ÆðÑо¿Ò»Ï£¬·Ç³£¼òµ¥¡£
¡¡¡¡±¾ÎIJÉÓÃJavaÓïÑÔÐ ......
1.
˳Ðò¿ØÖÆ
if
else
switch
¿ÉÒÔÓÃbyte,short,char,int×öΪ±í´ïʽÀàÐÍ
Ñ»·½á¹¹
while
do ...while
for
±êÇ©Ìøת£º
outer:
break outer;
outer:
continue outer;
2.Êý×éÀàÐÍ
Êý×éÒ²ÊÇÒ»ÖÖÊý¾ÝÀàÐÍ£¬Ëü±¾ÉíÊÇÒýÓÃÀàÐÍ¡£
¾²Ì¬³õʼ»¯£º³ÌÐòÔ±ÏÔʾָ¶¨³õʼֵ£¬ÏµÍ³¾ö¶¨³¤¶È¡£
¶¯Ì¬ ......