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

java Éú³ÉxmlÎļþ

import java.awt.Image;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
public class createXml
{
public static boolean writeXml(String path,String dir,String wpath,String wname)
{
File[] files = ReaderListFiles(path);
boolean flag = false;
if(files!=null)
{
StringBuffer xml = ReaderFilesContent(files,dir);
if(xml!=null)
flag = writeXmlFile(wname,wpath,xml);
}

return flag;
}

private static File[] ReaderListFiles(String path)
{
File file = new File(path);
if(file.exists()&&file.isDirectory())
return file.listFiles();
else if(file.exists()&&file.isFile())
{
File[] files = new File[1];
files[0] = file;
return files;
}
else
return null;
}

private static StringBuffer ReaderFilesContent(File[] files,String dir)
{
StringBuffer txml = new StringBuffer();
for(int i=0;i<files.length;i++)
{
String filename = files[i].getName();
String temp = filename.substring(filename.lastIndexOf(".")+1);
if(temp!=null&&(temp.equals("gif")||temp.equals("jpg")||temp.equals("bmp")||temp.equals("jpeg")||temp.equals("png")))
txml.append(getImgDesc(filename,temp,dir,files[i]));
}
if(txml.length()>0)
{
StringBuffer xml = new StringBuffer("<?xml version='1.0' encoding='GBK'?>\r\n");
xml.append("<firstnode>\r\n");
xml.append(txml);
xml.append("</firstnode>");
return xml;
}
else
return null;
}

private static StringBuffer getImgDesc(String filename,String type,String dir,File file)
{
Image imgSrc;
StringBuffer xml = new StringBuffer();
try {
imgSrc = ImageIO.read(file);
int width = imgSrc.getWidth(null);
int height = imgSrc.getHeight(null);
xml.append("\t<secondnode id=\"").append(filename).append("\">\r\n");
xml.append("\t\t<name>").append(filename).append("</name>\r\n");


Ïà¹ØÎĵµ£º

XML£¬XMLList

5.  ÃüÃû¹æÔò£¨²»ÄܰüÀ¨ xml£¬¿Õ¸ñ£¬¼âÀ¨ºÅ£¬µÈÌØÊâ·ûºÅ£¬²»ÄÜÊý×Ö¿ªÍ·£©
6.  ¿ÉÒÔ×Ô´øÊôÐÔ¡£ÊôÐÔÖµÓÓ”±êʾ
7.  ×¢ÊÍ<!--×¢Ê͵ÄÄÚÈÝ-->
8.  Èç¹ûÒªÏÔÊ¾ÌØÊâ·ûºÅ¿ÉÓÃ<![CDATA[  ÕâÀïÐ´ÌØÊâ·ûºÅ  ]]>
 
´´½¨
var xml:XML=<shuiGuo>
  & ......

java(Web)ÖÐÏà¶Ô·¾¶£¬¾ø¶Ô·¾¶ÎÊÌâ×ܽá

1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:\xyz\test.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶¡£
¡¡¡¡Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚ ......

JAVA»ñȡϵͳÐÅÏ¢

Properties props=System.getProperties(); //ϵͳÊôÐÔ
System.out.println("JavaµÄÔËÐл·¾³°æ±¾£º"+props.getProperty("java.version"));
System.out.println("JavaµÄÔËÐл·¾³¹©Ó¦ÉÌ£º"+props.getProperty("java.vendor"));
System.out.println("Java¹©Ó¦É̵ÄURL£º"+props.getProperty("java.vendor.url"));
Syste ......

Java AnnotationÈëÃÅ

ͻ񻣼
±¾ÎÄÕë¶Ôjava³õѧÕß»òÕßannotation³õ´ÎʹÓÃÕßÈ«ÃæµØËµÃ÷ÁËannotationµÄʹÓ÷½·¨¡¢¶¨Ò巽ʽ¡¢·ÖÀà¡£³õѧÕß¿ÉÒÔͨ¹ýÒÔÉϵÄ˵Ã÷ÖÆ×÷¼òµ¥µÄannotation³ÌÐò£¬µ«ÊǶÔÓÚһЩ¸ß¼¶µÄannotationÓ¦Óã¨ÀýÈçʹÓÃ×Ô¶¨ÒåannotationÉú³ÉjavabeanÓ³ÉäxmlÎļþ£©»¹ÐèÒª½øÒ»²½µÄÑо¿ºÍ̽ÌÖ¡£Éæ¼°µ½ÉîÈëannotationµÄÄÚÈÝ£¬×÷Õß½«ÔÚºóÎÄ¡ ......

¹ØÓÚJAVAµÄtry catch finallyµÄÒ»¸öÎÊÌâ

class TestTryFinallyC {
public static void main(String[] args) {
System.out.println(testt());
}

public static int testt() {
int x = 99;
try {
return x;
}finally {
x = 8;
}
}
}

ijÄêijÔµÄijһÌ죬 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ