Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ʹÓÃJava½øÐÐͼÏñ´¦Àí

¡¾Òý×Ô¼üÅÌÉϵÄÎèÕߵIJ©¿Í¡¿Í¼Ïñ±àÂëÊä³öµÄ·½·¨£¬Ìṩ±àÂë½ø¶È¼àÌý£¬ÉèÖñàÂëÖÊÁ¿µÄÖ§³Ö£¨Ìض¨¸ñʽ£¬ÀýÈçJPG£©¡£
Õâ¸ö·½·¨Ö§³ÖµÄ±àÂë¸ñʽÒÀÀµÔËÐл·¾³ÀïImageIOÒѾ­×¢²áImageWriter¼¯ºÏ¡£
Java SE 6ÖеÄImageIOĬÈÏÖ§³ÖJPG£¬BMP£¬PNG£¬GIFµÈ¸ñʽ£¬Ò²¿ÉÒÔͨ¹ý·Ç±ê×¼Àà¿âÌí¼ÓImageIO¶ÔͼÏñ¸ñʽµÄÖ§³Ö£¬±ÈÈç°²×°JAI_ImageIO¡£
/** *//**
* ½«BufferedImage±àÂëÊä³ö³ÉÓ²ÅÌÉϵÄͼÏñÎļþ¡£
* Õâ¸ö·½·¨Ö§³ÖµÄ±àÂë¸ñʽÒÀÀµÔËÐл·¾³ÀïImageIOÒѾ­×¢²áImageWriter¼¯ºÏ¡£
*
* @param file±àÂëÊä³öµÄÄ¿±êͼÏñÎļþÃû£¬ÎļþÃûµÄºó׺ȷ¶¨±àÂë¸ñʽ¡£
* @param image´ý±àÂëµÄͼÏñ¶ÔÏó¡£
* @param quality±àÂëѹËõµÄ°Ù·Ö±È¡£
* @param progressListener±àÂë½ø¶ÈµÄ¼àÌýÆ÷¡£
* @return·µ»Ø±àÂëÊä³ö³É¹¦Óë·ñ¡£
*/
public boolean writeImageFile(File file, BufferedImage image, int quality, IIOWriteProgressListener progressListener) ...{
try ...{
String suffix = getFileSuffix(file);if (suffix == null) ...{
return false;
}Iterator it = ImageIO.getImageWritersBySuffix(suffix);
if (it.hasNext()) ...{FileImageOutputStream fileImageOutputStream = new FileImageOutputStream(file);
ImageWriter iw = (ImageWriter) it.next();ImageWriteParam iwp = iw.getDefaultWriteParam();
iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
iwp.setCompressionQuality(quality / 100.0f);iw.setOutput(fileImageOutputStream);
iw.addIIOWriteProgressListener(progressListener);
iw.write(null, new javax.imageio.IIOImage(image, null, null), iwp);
iw.dispose();fileImageOutputStream.flush();
fileImageOutputStream.close();
}
} catch (Exception ex) ...{
ex.printStackTrace();
return false;
}
return true;
}
getFileSuffix()  ¹ËÃû˼Ò壬ÊÇÈ¡µÃÎļþºó׺µÄ·½·¨¡£/** *//**
* È¡µÃÎļþºó׺¡£
* Èç¹ûÎļþÊäÈë²ÎÊýΪ null ·µ»Ø null¡£
*
* @param file
* @return
*/
public String getFileSuffix(File file) ...{
if (file == null) ...{
return null;
}
return getFileSuffix(file.getName());
}
/** *//**
* È¡µÃÎļþºó׺¡£
* Èç¹ûÎļþÃûÊäÈëΪ null ·µ»Ø null£»
* Èç¹ûûÓÐÈ¡µÃºó׺Ôò·µ»Ø ""¡£
*
* @param fileName
* @return
*/
public String getFileSuffix(String fil


Ïà¹ØÎĵµ£º

java IO

JavaÓïÑÔµÄÊäÈëÊä³ö¹¦ÄÜÊÇÊ®·ÖÇ¿´ó¶øÁé»îµÄ£¬ÃÀÖв»×ãµÄÊÇ¿´ÉÏÈ¥ÊäÈëÊä³öµÄ´úÂë²¢²»ÊǺܼò½à£¬ÒòΪÄãÍùÍùÐèÒª°ü×°Ðí¶à²»Í¬µÄ¶ÔÏó¡£ÔÚJavaÀà¿âÖУ¬IO²¿·ÖµÄÄÚÈÝÊǺÜÅÓ´óµÄ£¬ÒòΪËüÉæ¼°µÄÁìÓòºÜ¹ã·º:±ê×¼ÊäÈëÊä³ö£¬ÎļþµÄ²Ù×÷£¬ÍøÂçÉϵÄÊý¾ÝÁ÷£¬×Ö·û´®Á÷£¬¶ÔÏóÁ÷£¬zipÎļþÁ÷....±¾ÎĵÄÄ¿µÄÊÇΪ´ó¼Ò×öÒ»¸ö¼òÒªµÄ½éÉÜ¡£
¡¡¡¡Á ......

Java Reflect ·´Éä»úÖÆ Ñ§Ï°±Ê¼Ç [ÍòÄÜtoString·½·¨]

ÀûÓÃJava Reflect»úÖƱàдÍòÄÜtoString()·½·¨:
 
 
package com.accp.test.filed;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;

publ ......

Java ¸´Ï°±Ê¼Ç_µÚ3Ìì


Êý¾Ý½á¹¹ºÍËã·¨
ðÅÝ£ºÃ¿´Î±È½Ï¶¼¿ÉÕÒ³ö×î´ó»ò×îСµÄ£¬ÓÐÐòµÄÔÚ×îÓÒ±ß
Ñ¡ÔñÅÅÐò£ºÓÐÐòµÄÔÚ×î×ó±ß
²åÈëÅÅÐò£ºËٶȱÈðÅÝ¿ìÒ»±¶£¬±ÈÑ¡ÔñÒ²¿ì¡£
    
µÝ¹é
      
µ÷ÓÃ×ÔÉí
      
ººÅµËþÎÊÌ⣺
/**
* @ººÅµËþµÄÎÊÌâ
*/ ......

ÊÕ¼¯µ½µÄjava ÕýÔòÑéÖ¤

Java´úÂ룺
import java.util.regex.*;
public final class RegExpValidator
{
/**
* ÑéÖ¤ÓÊÏä
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean isEmail(String str)
{
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ