Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ :

JNI¼¼ÊõʵÏÖJAVA³ÌÐòµ÷ÓÃdll


JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ­¾­¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿ÚºÍÉ豸ͨÐÅ,ÕâÖÖÇé¿öϾ͵ÿ¼ÂÇʹÓÃjava³ÌÐòÈ¥µ÷ÓñȽÏÉó¤Í¬ÏµÍ³´ò½»µÀµÄµÚÈý·½³ÌÐò,´Ó1.1°æ±¾¿ªÊ¼µÄJDKÌṩÁ˽â¾öÕâ¸öÎÊÌâµÄ¼¼Êõ±ê×¼:JNI¼¼Êõ.
       JNIÊÇJava Native Interface(Java±¾µØ½Ó¿Ú)µÄËõд,±¾µØÊÇÏà¶ÔÓÚjava³ÌÐòÀ´ËµµÄ,Ö¸Ö±½ÓÔËÐÐÔÚ²Ù×÷ϵͳ֮ÉÏ,Óë²Ù×÷ϵͳֱ½Ó½»»¥µÄ³ÌÐò.´Ó1.1°æ±¾µÄJDK¿ªÊ¼,JNI¾Í×÷Ϊ±ê׼ƽ̨µÄÒ»²¿·Ö·¢ÐÐ.ÔÚJNI³öÏֵijõÆÚÊÇΪÁËJava³ÌÐòÓë±¾µØÒѱàÒëÓïÑÔ,ÓÈÆäÊÇCºÍC++µÄ»¥²Ù×÷¶øÉè¼ÆµÄ,ºóÀ´¾­¹ýÀ©Õ¹Ò²¿ÉÒÔÓëcºÍc++Ö®ÍâµÄÓïÑÔ±àдµÄ³ÌÐò½»»¥,ÀýÈçDelphi³ÌÐò.
       ʹÓÃJNI¼¼Êõ¹ÌÈ»ÔöÇ¿ÁËjava³ÌÐòµÄÐÔÄܺ͹¦ÄÜ,µ«ÊÇËüÒ²ÆÆ»µÁËjavaµÄ¿çƽ̨µÄÓŵã,Ó°Ïì³ÌÐòµÄ¿ÉÒÆÖ²ÐԺͰ²È«ÐÔ,ÀýÈçÓÉÓÚÆäËûÓïÑÔ(ÈçC/C++)¿ÉÄÜÄܹ»ËæÒâµØ·ÖÅä¶ÔÏó/Õ¼ÓÃÄÚ´æ,JavaµÄÖ¸Õ밲ȫÐԵò ......

ÓйØjavaÖеÄString£¬StringBuffer£¬StringBuild

String ×Ö·û´®³£Á¿
StringBuffer ×Ö·û´®±äÁ¿£¨Ḭ̈߳²È«£©
StringBuilder ×Ö·û´®±äÁ¿£¨·ÇḬ̈߳²È«£©
¼òÒªµÄ˵£¬ String ÀàÐÍºÍ StringBuffer ÀàÐ͵ÄÖ÷ÒªÐÔÄÜÇø±ðÆäʵÔÚÓÚ String ÊDz»¿É±äµÄ¶ÔÏó, Òò´ËÔÚÿ´Î¶Ô String ÀàÐͽøÐиıäµÄʱºòÆäʵ¶¼µÈͬÓÚÉú³ÉÁËÒ»¸öÐ嵀 String ¶ÔÏó£¬È»ºó½«Ö¸ÕëÖ¸ÏòÐ嵀 String ¶ÔÏó£¬ËùÒÔ¾­³£¸Ä±äÄÚÈݵÄ×Ö·û´®×îºÃ²»ÒªÓà String £¬ÒòΪÿ´ÎÉú³É¶ÔÏ󶼻á¶ÔϵͳÐÔÄܲúÉúÓ°Ï죬Ìرðµ±ÄÚ´æÖÐÎÞÒýÓöÔÏó¶àÁËÒÔºó£¬ JVM µÄ GC ¾Í»á¿ªÊ¼¹¤×÷£¬ÄÇËÙ¶ÈÊÇÒ»¶¨»áÏ൱ÂýµÄ¡£
¶øÈç¹ûÊÇʹÓà StringBuffer ÀàÔò½á¹û¾Í²»Ò»ÑùÁË£¬Ã¿´Î½á¹û¶¼»á¶Ô StringBuffer ¶ÔÏó±¾Éí½øÐвÙ×÷£¬¶ø²»ÊÇÉú³ÉеĶÔÏó£¬Ôٸıä¶ÔÏóÒýÓá£ËùÒÔÔÚÒ»°ãÇé¿öÏÂÎÒÃÇÍƼöʹÓà StringBuffer £¬ÌرðÊÇ×Ö·û´®¶ÔÏó¾­³£¸Ä±äµÄÇé¿öÏ¡£¶øÔÚijЩÌرðÇé¿öÏ£¬ String ¶ÔÏóµÄ×Ö·û´®Æ´½ÓÆäʵÊDZ» JVM ½âÊͳÉÁË StringBuffer ¶ÔÏóµÄÆ´½Ó£¬ËùÒÔÕâЩʱºò String ¶ÔÏóµÄËٶȲ¢²»»á±È StringBuffer ¶ÔÏóÂý£¬¶øÌرðÊÇÒÔϵÄ×Ö·û´®¶ÔÏóÉú³ÉÖУ¬ String ЧÂÊÊÇÔ¶Òª±È StringBuffer ¿ìµÄ£º
String S1 = “This is only a” + “ simple” + “ test”;
StringBuffer Sb = n ......

java ¼¯ºÏ

< type="text/javascript"> document.body.oncopy = function() { if (window.clipboardData) { setTimeout(function() { var text = clipboardData.getData("text"); if (text && text.length>300) { text = text + "\r\n\n±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£º" + location.href; clipboardData.setData("text", text); } }, 100); } } <>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}
 
-¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í¬¼¯ºÏÀàÐÍ£¬ÊǼ¯ºÏ¿ò¼ÜµÄ»ù´¡¡£
¡¡¡¡-³éÏóÀࣺ5¸ö³éÏóÀࣨ³¤ÐéÏß±íʾ£©£¬¶Ô¼¯ºÏ½Ó¿ÚµÄ²¿·ÖʵÏÖ¡£¿ÉÀ©Õ¹Îª×Ô¶¨Ò弯ºÏÀà¡£
¡¡¡¡-ʵÏÖÀࣺ8¸öʵÏÖÀࣨʵÏß±íʾ£©£¬¶Ô½Ó¿ÚµÄ¾ßÌåʵÏÖ¡£
¡¡¡¡2.JavaÈÝÆ÷Àà½éÉÜ
¡¡¡¡¢Ù JavaÈÝÆ÷À඼¿ÉÒÔ×Ô¶¯µØµ÷Õû×Ô¼ºµÄ ......

socketͨÐÅjava»òc#ÖÐÎÄÂÒÂëÎÊÌâ

C#ÖÐÏÔʾÖÐÎÄ£º
¡¾
·¢ËÍÊý¾Ý£º  
  string   sReturnData   =   "ÄãºÃ";  
  Byte[]  
bReturnData   =   Encoding.ASCII.GetBytes(sReturnData.ToCharArray());  
 
m_sktSession.Send(bReturnData); 
¡¾½«³öÏÖÂÒÂë¡¿
¡¿ 
½â¾ö·½°¸£º
±àÂëÓÃutf-8  
  string   sReturnData   =   "ÄãºÃ";  
  Byte[]  
bReturnData   =   UTF8Encoding.UTF8.GetBytes(sReturnData);  
  ½âÂëÒ²Óà  
utf-8  
  string   sReturnData   =  
UTF8Encoding.UTF8.GetString(sReturnData)
javaÖÐÏÔʾÖÐÎÄ£º
 ¡¾
os.write(temp.getBytes("ISO-8859-1"));
¡¾½«³öÏÖÂÒÂë¡¿
¡¿
½â¾ö·½°¸£º
os.write(temp.getBytes("UTF-8")); ......

socketͨÐÅjava»òc#ÖÐÎÄÂÒÂëÎÊÌâ

C#ÖÐÏÔʾÖÐÎÄ£º
¡¾
·¢ËÍÊý¾Ý£º  
  string   sReturnData   =   "ÄãºÃ";  
  Byte[]  
bReturnData   =   Encoding.ASCII.GetBytes(sReturnData.ToCharArray());  
 
m_sktSession.Send(bReturnData); 
¡¾½«³öÏÖÂÒÂë¡¿
¡¿ 
½â¾ö·½°¸£º
±àÂëÓÃutf-8  
  string   sReturnData   =   "ÄãºÃ";  
  Byte[]  
bReturnData   =   UTF8Encoding.UTF8.GetBytes(sReturnData);  
  ½âÂëÒ²Óà  
utf-8  
  string   sReturnData   =  
UTF8Encoding.UTF8.GetString(sReturnData)
javaÖÐÏÔʾÖÐÎÄ£º
 ¡¾
os.write(temp.getBytes("ISO-8859-1"));
¡¾½«³öÏÖÂÒÂë¡¿
¡¿
½â¾ö·½°¸£º
os.write(temp.getBytes("UTF-8")); ......

ʹÓÃJavaµÈ±ÈÀýËõ·ÅͼÏñ

±¾ÎÄת×Ôhttp://blog.csdn.net/nokiaguy/archive/2010/04/16/5493817.aspx
Ëõ·ÅͼÏñµÄ»ù±¾Ô­ÀíÊÇ´´½¨Ò»¸öÄ¿±ê´óСµÄ»­²¼£¬È»ºó¶ÁȡԴͼÏñ£¬²¢½«¸ÃͼÏñ»æÖÆÕâ¸ö»­²¼ÉÏ¡£ÎªÁËʹ³ÌÐòͨÓã¬Ô´Í¼ÏñºÍËõ·ÅºóµÄÄ¿±êͼÏñÓ¦Ó÷ֱðʹÓÃ
InputStreamºÍOutputStreamÀ´±íʾ£¬´úÂëÈçÏ£º
    
public
 
static
 
void
 scaleImage(InputStream imgInputStream,
            OutputStream imgOutputStream, 
int
 scale)
    {
        
try
        {
            Image src 
=
 javax.imageio.ImageIO.read(imgInputStream);
            
int
 width 
=
 (
int
) (src.getWidth(
null

*
 scale 
/
 
100.0
);
    ......

ʹÓÃJavaµÈ±ÈÀýËõ·ÅͼÏñ

±¾ÎÄΪԭ´´£¬ÈçÐèתÔØ£¬Çë×¢Ã÷×÷Õߺͳö´¦£¬Ð»Ð»£¡
   
Ëõ·ÅͼÏñµÄ»ù±¾Ô­ÀíÊÇ´´½¨Ò»¸öÄ¿±ê´óСµÄ»­²¼£¬È»ºó¶ÁȡԴͼÏñ£¬²¢½«¸ÃͼÏñ»æÖÆÕâ¸ö»­²¼ÉÏ¡£ÎªÁËʹ³ÌÐòͨÓã¬Ô´Í¼ÏñºÍËõ·ÅºóµÄÄ¿±êͼÏñÓ¦Ó÷ֱðʹÓÃ
InputStreamºÍOutputStreamÀ´±íʾ£¬´úÂëÈçÏ£º
    
public
 
static
 
void
 scaleImage(InputStream imgInputStream,
            OutputStream imgOutputStream, 
int
 scale)
    {
        
try
        {
            Image src 
=
 javax.imageio.ImageIO.read(imgInputStream);
            
int
 width 
=
 (
int
) (src.getWidth(
null

*
 scale 
/
 
100.0
);
   &n ......
×ܼǼÊý:40319; ×ÜÒ³Êý:6720; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [15] [16] [17] [18] 19 [20] [21] [22] [23] [24]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ