cºÍjavaÖеĶþ½øÖÆÎļþ
×î½üÐèҪдһ¶Î³ÌÐò£¬Íê³ÉÒÔÏµĹ¤×÷£¬ÓÃjava½«Êý¾ÝÒÔ¶þ½øÖƵÄÐÎʽдÈëÎļþÖУ¬È»ºóÓÃC¶Á³ö´Ë¶þ½øÖÆÎļþ¡£
¿ªÊ¼µÄʱºòûÓп¼ÂÇ»úÆ÷µÄ×Ö½ÚÐò£¬Ö±½Ó¸ã³ösegment fault.ÏëÁ˺ܾ㬲ÅÃ÷°×ÔÀ´ÊÇjavaºÍCµÄ×Ö½ÚÐòÊDz»Ò»ÑùµÄ¡£
javaÖеÄ×Ö½ÚÐòÊÇbig endianµÄ£¬ËüÊÇÓë»úÆ÷Î޹صġ£¶øcµÄ×Ö»úÐòÊÇ»úÆ÷Ïà¹ØµÄ£¬¶øµ±Ç°ÓõĻúÆ÷ÊÇx84_64½á¹¹£¬ÊÇlittle endianµÄ£¬
ËùÒÔ³ö´í¾Í²»×ãΪÆæÁË¡£
±³¾°ÖªÊ¶£º
Ö÷»ú×Ö½ÚÐò
²»Í¬µÄCPUÓв»Í¬µÄ×Ö½ÚÐòÀàÐÍ ÕâЩ×Ö½ÚÐòÊÇÖ¸ÕûÊýÔÚÄÚ´æÖб£´æµÄ˳Ðò Õâ¸ö½Ð×öÖ÷»úÐò
×î³£¼ûµÄÓÐÁ½ÖÖ
1£® Little endian£º½«µÍÐò×Ö½Ú´æ´¢ÔÚÆðʼµØÖ·
2£® Big endian£º½«¸ßÐò×Ö½Ú´æ´¢ÔÚÆðʼµØÖ·
LE little-endian
×î·ûºÏÈ˵Ä˼άµÄ×Ö½ÚÐò
µØÖ·µÍλ´æ´¢ÖµµÄµÍλ
µØÖ·¸ßλ´æ´¢ÖµµÄ¸ßλ
Ôõô½²ÊÇ×î·ûºÏÈ˵Ä˼άµÄ×Ö½ÚÐò£¬ÊÇÒòΪ´ÓÈ˵ĵÚÒ»¹Û¸ÐÀ´Ëµ
µÍλֵС£¬¾ÍÓ¦¸Ã·ÅÔÚÄÚ´æµØַСµÄµØ·½£¬Ò²¼´ÄÚ´æµØÖ·µÍλ
·´Ö®£¬¸ßλֵ¾ÍÓ¦¸Ã·ÅÔÚÄÚ´æµØÖ·´óµÄµØ·½£¬Ò²¼´ÄÚ´æµØÖ·¸ßλ
BE big-endian
×îÖ±¹ÛµÄ×Ö½ÚÐò
µØÖ·µÍλ´æ´¢ÖµµÄ¸ßλ
µØÖ·¸ßλ´æ´¢ÖµµÄµÍλ
Ϊʲô˵ֱ¹Û£¬²»Òª¿¼ÂǶÔÓ¦¹Øϵ
Ö»ÐèÒª°ÑÄÚ´æµØÖ·´Ó×óµ½ÓÒ°´ÕÕÓɵ͵½¸ßµÄ˳Ðòд³ö
°ÑÖµ°´ÕÕͨ³£µÄ¸ßλµ½µÍλµÄ˳Ðòд³ö
Á½Õ߶ÔÕÕ£¬Ò»¸ö×Ö½ÚÒ»¸ö×Ö½ÚµÄÌî³ä½øÈ¥
Àý×Ó£ºÔÚÄÚ´æÖÐË«×Ö0x01020304(DWORD)µÄ´æ´¢·½Ê½
ÄÚ´æµØÖ·
4000 4001 4002 4003
LE 04 03 02 01
BE 01 02 03 04
Àý×Ó£ºÈç¹ûÎÒÃǽ«0x1234abcdдÈëµ½ÒÔ0x0000¿ªÊ¼µÄÄÚ´æÖУ¬Ôò½á¹ûΪ
big-endian little-endian
0x0000 0x12 0xcd
0x0001 0x23 0xab
0x0002 0xab 0x34
0x0003 0xcd 0x12
x86ϵÁÐCPU¶¼ÊÇlittle-endianµÄ×Ö½ÚÐò.
ÍøÂç×Ö½ÚÐò
ÍøÂç×Ö½Ú˳ÐòÊÇTCP/IPÖй涨ºÃµÄÒ»ÖÖÊý¾Ý±íʾ¸ñʽ£¬ËüÓë¾ßÌåµÄCPUÀàÐÍ¡¢²Ù×÷ϵͳµÈÎ޹أ¬´Ó¶ø¿ÉÒÔ±£Ö¤Êý¾ÝÔÚ²»Í¬Ö÷»úÖ®¼ä´«ÊäʱÄܹ»±»ÕýÈ·½âÊÍ¡£ÍøÂç×Ö½Ú˳Ðò²ÉÓÃbig endianÅÅÐò·½Ê½¡£
ΪÁ˽øÐÐת»» bsd socketÌṩÁËת»»µÄº¯Êý ÓÐÏÂÃæËĸö
htons °Ñunsigned shortÀàÐÍ´ÓÖ÷»úÐòת»»µ½ÍøÂçÐò
htonl °Ñunsigned longÀàÐÍ´ÓÖ÷»úÐòת»»µ½ÍøÂçÐò
ntohs °Ñunsigned shortÀàÐÍ´ÓÍøÂçÐòת»»µ½Ö÷»úÐò
ntohl °Ñunsigned longÀàÐÍ´ÓÍøÂçÐòת»»µ½Ö÷»úÐò
ÔÚʹÓÃlittle endianµÄϵͳÖÐ ÕâЩº¯Êý»á°Ñ×Ö½ÚÐò½øÐÐת»»
ÔÚʹÓÃbig endianÀàÐ͵ÄϵͳÖÐ ÕâЩº¯Êý»á¶¨Òå³É¿Õºê
ͬÑù ÔÚÍøÂç³ÌÐò¿ª·¢Ê± »òÊÇ¿çƽÌ
Ïà¹ØÎĵµ£º
×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......
1¡¢²âÊÔ·½·¨ÈçÏ£º
public static String toUtf8(String str) {
return new String(str.getBytes("UTF-8"),"UTF-8"):
&nb ......
Ã÷ÌìÓÐÒ»¸öеľÍÒµ°à¿ª¿ÎÁË£¬ÓеÄͬѧ¾ö¶¨×ª°à£¬×Ô¼ºÐÄÀïҲͦì¶ÜµÄ£¬ÓÌÔ¥²»¾ö£¡
È¥¿ÉÒÔÈÃ×Ô¼º¶Ô»ù´¡¸ü¼ÓÊìÁ·£¬±Ï¾¹ËùÓеÄ֪ʶ¶¼ÊÇж«Î÷£¬Èç¹ûÓиü¶àµÄʱ¼äÁ·Ï°£¬Ð§¹ûÒ»
¶¨¸üºÃ£¡²»È¥ÊǾõµÃÔÀí¶¼¶®µÃÁË£¬Ö»Òª¼á³ÖÉÏÍêʣϵĿγ̣¬¿ÉÒÔÔÙÈ¥ÂýÂýÁ·Ï°´úÂ룬ûÓÐ
±ØÒªÀË·Ñʱ¼ä£¿ºÃì¶Ü£¬Ã÷ÌìÕÒÕÅÀÏʦ×ÉѯÏÂ....
½ñ ......
ÔÚ½øÐÐMISϵͳ¿ª·¢¹ý³ÌÖÐ,´ÓÅäÖÃÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢ÊÇÿһ¸öϵͳ±ØÐë¾ß±¸µÄ¹¦ÄÜ,ÀýÈç,ÎÒÃÇÒªÅäÖöÁÈ¡Êý¾Ý¿âÅäÖÃÐÅÏ¢,°üÀ¨Çý¶¯³ÌÐòÃû¡¢Á¬½Ó×Ö·û´®£¬Óû§Ãû£¬¿ÚÁîµÈÐÅÏ¢£¬ÓÉÓÚÕâЩÐÅÏ¢»áËæ×ÅÓû§µÄ²»Í¬¶ø·¢Éú¸Ä±ä£¬ËùÒÔ²»ÄÜÖ±½Ó°Ñ²ÎÊýдÔÚ³ÌÐòÖУ¬½«ÆäдÈëÅäÖÃÎļþ£¬È»ºóÔÚÓ¦ÓóÌÐòÖжÁÈ¡ÅäÖÃÐÅÏ¢²¢¼ÓÒÔʹÓã¬ÊÇÒ»¸ö³É ......