ÀûÓÃJAVA¶ÁÈ¡EXCELÎļþ
1 ´ÓExcelÎļþ¶ÁÈ¡Êý¾Ý±í
Java Excel API¼È¿ÉÒÔ´Ó±¾µØÎļþϵͳµÄÒ»¸öÎļþ(.xls)£¬Ò²¿ÉÒÔ´ÓÊäÈëÁ÷ÖжÁÈ¡ExcelÊý¾Ý±í¡£¶ÁÈ¡ExcelÊý¾Ý±íµÄµÚÒ»²½ÊÇ´´½¨Workbook(ÊõÓ¹¤×÷±¡)£¬ÏÂÃæµÄ´úÂëÆ¬¶Î¾ÙÀý˵Ã÷ÁËÓ¦¸ÃÈçºÎ²Ù×÷£º
import java.io.*;
import jxl.*;
try
{
//¹¹½¨Workbook¶ÔÏó, Ö»¶ÁWorkbook¶ÔÏó
//Ö±½Ó´Ó±¾µØÎļþ´´½¨Workbook
//´ÓÊäÈëÁ÷´´½¨Workbook
InputStream is = new FileInputStream(sourcefile);
jxl.Workbook rwb = Workbook.getWorkbook(is);
}
catch (Exception e)
{
e.printStackTrace();
}
Ò»µ©´´½¨ÁËWorkbook£¬ÎÒÃǾͿÉÒÔͨ¹ýËüÀ´·ÃÎÊExcel Sheet(ÊõÓ¹¤×÷±í)¡£
//»ñÈ¡µÚÒ»ÕÅSheet±í
Sheet rs = rwb.getSheet(0);
ÎÒÃǼȿÉÄÜͨ¹ýSheetµÄÃû³ÆÀ´·ÃÎÊËü£¬Ò²¿ÉÒÔͨ¹ýϱêÀ´·ÃÎÊËü¡£Èç¹ûͨ¹ýϱêÀ´·ÃÎʵϰ£¬Òª×¢ÒâµÄÒ»µãÊÇϱê´Ó0¿ªÊ¼£¬¾ÍÏñÊý×éÒ»Ñù¡£
Ò»µ©µÃµ½ÁËSheet£¬ÎÒÃǾͿÉÒÔͨ¹ýËüÀ´·ÃÎÊExcel Cell(ÊõÓµ¥Ôª¸ñ)¡£²Î¿¼ÏÂÃæµÄ´úÂëÆ¬¶Î£º//»ñÈ¡µÚÒ»ÐУ¬µÚÒ»ÁеÄÖµ,ÁкÅÔÚÇ°Ãæ,ÐкÅÔÚºóÃæ
Cell c00 = rs.getCell(0, 0);
String strc00 = c00.getContents();
//»ñÈ¡µÚÒ»ÐУ¬µÚ¶þÁеÄÖµ
Cell c10 = rs.getCell(1, 0);
String strc10 = c10.getContents();
//»ñÈ¡µÚ¶þÐУ¬µÚ¶þÁеÄÖµ
Cell c11 = rs.getCell(1, 1);
String strc11 = c11.getContents();
System.out.println("Cell(0, 0)" + " value : " + strc00 + "; type : " + c00.getType());
System.out.println("Cell(1, 0)" + " value : " + strc10 + "; type : " + c10.getType());
System.out.println("Cell(1, 1)" + " value : " + strc11 + "; type : " + c11.getType());
Èç¹û½ö½öÊÇÈ¡µÃCellµÄÖµ£¬ÎÒÃÇ¿ÉÒÔ·½±ãµØÍ¨¹ýgetContents()·½·¨£¬Ëü¿ÉÒÔ½«ÈκÎÀàÐ͵ÄCellÖµ¶¼×÷Ϊһ¸ö×Ö·û´®·µ»Ø¡£Ê¾Àý´úÂëÖÐCell(0, 0)ÊÇÎı¾ÐÍ£¬Cell(1, 0)ÊÇÊý×ÖÐÍ£¬Cell(1,1)ÊÇÈÕÆÚÐÍ£¬Í¨¹ýgetContents()£¬ÈýÖÖÀàÐ͵ķµ»ØÖµ¶¼ÊÇ×Ö·ûÐÍ¡£
Èç¹ûÓÐÐèÒªÖªµÀCellÄÚÈݵÄÈ·ÇÐÀàÐÍ£¬APIÒ²ÌṩÁËһϵÁеķ½·¨¡£²Î¿¼ÏÂÃæµÄ´úÂëÆ¬¶Î£ºString strc00 = null;
double strc10 = 0.00;
Date strc11 = null;
Cell c00 = rs.getCell(0, 0);
Cell c10 = rs.getCell(1, 0);
Cell c11 = rs.getCell(1, 1);
if(c00.getType() == CellType.LABEL)
{
LabelCell labelc00 = (LabelCell)c00;
str
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔǰ£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
FileÀà
´´½¨Ä¿Â¼£¬ÓÃmkdirºÍmkdirsµÄº¯Êý
public boolean mkdir():´´½¨´Ë³éÏó·¾¶ÃûÖ¸¶¨µÄĿ¼¡£
public boolean mkdirs():´´½¨´Ë³éÏó·¾¶ÃûÖ¸¶¨µÄĿ¼£¬°üÀ¨ËùÓбØÐ赫²»´æÔڵĸ¸Ä¿Â¼¡£×¢Ò⣬´Ë²Ù×÷ʧ°ÜʱҲ¿ÉÄÜÒѾ³É¹¦µØ´´½¨ÁËÒ»²¿·Ö±ØÐèµÄ¸¸Ä¿Â¼¡£
mkdirÀý×Ó£º
File dir = new File("E:/mydir/");
if(!di ......
ÌâÄ¿£ºÇëÓöàÏß³ÌʵÏÖÒ»¸öÉú²úÕßÀàºÍÒ»¸öÏû·ÑÕßÀ࣬Éú²úÕßËæ»úÉú³É20¸ö×Ö·û£¬Ïû·ÑÕß½«×Ö·û´òÓ¡µ½¿ØÖÆÌ¨¡£
class SyncStack{ //ͬ²½¶ÑÕ»Àà
¡¡¡¡¡¡private int index = 0; //¶ÑÕ»Ö¸Õë³õʼֵΪ0
¡¡¡¡¡¡private char []buffer = new char[6]; //¶ÑÕ»ÓÐ6¸ö×Ö·ûµÄ¿Õ¼ä
¡¡¡¡¡¡public synchronized void push(char c){ //¼ÓÉ ......
ÔÚÍøÉÏÒ²¿´Á˺ܶණÎ÷£¬¹ØÓÚJAVAÈí¼þ¼Ü¹¹·½ÃæµÄ¶«Î÷£¬ÏÖÔÚ»¹ÕæÊǺÜÄÑÕÒµ½£¬²»¹ý£¬Èí¼þ¿ª·¢µÄ¼Ü¹¹»ù±¾ÊÇÏàͬµÄ¡£ËùÒÔ£¬ÎÒÔÚÍøÉϲéÕÒÁ˺ܶàÆäËûÓïÑÔ¹ØÓÚÈí¼þ¼Ü¹¹·½ÃæµÄÎÄÕ¡£ÔÙÕâÀïÒ²À´ËµËµ×Ô¼º¶ÔÈí¼þ¼Ü¹¹£¬ÌرðÊÇÔÚJAVAÏîÄ¿¼Ü¹¹·½ÃæµÄ¿´·¨¡£ËµµÃ²»Ò»¶¨¶Ô£¬µ«ÕâÒ²ÊÇÎÒ¼¸ÄêÀ´µÄ×ܽá°É¡£
1. ¾¡Á¿²»Òª¿¼ÂÇÏîÄ¿ÍâµÄÖØÓÃ
Ðí¶àÈË ......