javaʵÏÖzipÓëunzip
jdkÌṩÁËZipÏà¹ØµÄÀà·½±ãµÄʵÏÖѹËõºÍ½âѹËõ¡£Ê¹Ó÷½·¨ºÜ¼òµ¥¡£Ï±߷ֱðÊÇѹËõºÍ½âѹËõµÄ¼òµ¥ÊÂÀý
1£¬Ñ¹ËõµÄ
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class Zip {
static final int BUFFER = 2048;
public static void main(String argv[]) {
try {
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream("E:\\test\\myfiles.zip");
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(
dest));
byte data[] = new byte[BUFFER];
File f = new File("e:\\test\\a\\");
File files[] = f.listFiles();
for (int i = 0; i < files.length; i++) {
FileInputStream fi = new FileInputStream(files[i]);
Ïà¹ØÎĵµ£º
¹ØÓÚJavaÒç³ö·ÖÀ࣬ÎÒ¾³£Åöµ½µÄÊÇÁ½ÀࣺһÀàÊÇjava.lang.OutOfMemoryError: Java heap space£¬Ò»ÀàÊÇjava.lang.OutOfMemoryError: PermGen space¡£
ÔÚÕâÁ½ÀàÖУ¬Ç°ÕßÅö¼ûµÄ´ÎÊý±È½ÏƵ·±¡£ÒòΪµ¼ÖÂJava heap spaceµÄÇé¿ö£¬ÓÐʱºò²¢²»ÊÇÄÚ´æ²»¹»£¬ËüÒ²»áÅ×´Ë´íÎóÐÅÏ¢¡£ÀýÈçÎÒ¾ÍÅöµ½¹ýÕâÑùµÄÇé¿ö£¬ÎÒµ±Ê±Í¨¹ýGCÈÕÖ¾·¢ÏÖ£¬ÄÚ´ ......
Ò»¸öJava´°¿Ú´ø°´¼ü¼ì²â£¨ÅÜJava¿ÉÊÓС³ÌÐòʱÓã©£¬沒¼ÓÐÞÊΣ¬°³×Ô¼ºÓõΡ£
package math;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/**
* »ù±¾µÄ»æͼ´°¿Ú£¬»Ø³µ¹Ø±Õ´°¿Ú
*/
@SuppressWarnings("s ......
1. Ó¦Ó÷¶Î§
±¾¹æ·¶Ó¦ÓÃÓÚ²ÉÓÃJ2EE¹æ·¶µÄÏîÄ¿ÖУ¬ËùÓÐÏîÄ¿ÖеÄJAVA´úÂ루º¬JSP£¬SERVLET£¬JAVABEAN£¬EJB£©¾ùÓ¦×ñÊØÕâ¸ö¹æ·¶¡£Í¬Ê±£¬Ò²¿É×÷ΪÆäËüÏîÄ¿µÄ²Î¿¼¡£
2. Éè¼ÆÀàºÍ·½·¨
2.1 ´´½¨¾ßÓкÜÇ¿ÄÚ¾ÛÁ¦µÄÀà
·½·¨µÄÖØÒªÐÔÍùÍù±ÈÀàµÄÖØÒªÐÔ¸üÈÝÒ×Àí½â£¬·½·¨ÊÇÖ¸Ö´ÐÐÒ»¸öͳһº¯ÊýµÄÒ»¶Î´úÂë¡£Àà³£± ......
Problem: email thread is hanging at socket read
Today we found a email problem in production, all of the mail threads (3 threads) are hanging/sitting/blocking at same point
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
......