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

C#µ½Java byteÀàÐͳåÍ»µÄ½â¾ö

×î½üÒª¸Äдһ¸öºËÐļÓÃÜÈÏÖ¤À࣬´ÓC#¸Äд³ÉJava¡£
·¢ÏÖÔÚµ÷ÊÔʱ£¬¼ÓÃܵÄÊý¾ÝÎÞÂÛÈçºÎÒ²¶Ô²»ÉÏ¡£
¾­¹ý¸ú×Ù£¬·¢ÏÖÎÊÌâ³öÔÚC#ºÍJava byteÀàÐ͵ÄÇø±ðÉÏ£ºÔÚC#Àï byteÀàÐÍÊÇÎÞ·ûºÅµÄ£¬¶øJavaÀïÊÇÓзûºÅµÄ£¬ËùÒÔC#ÀïµÄ129µ½JavaÀï¾Í³ÉÁ˸ºÊý¡£
·¢ÏÖÁËÎÊÌ⣬½â¾ö¾Í±È½ÏÈÝÒ×ÁË£¬Õë¶ÔJavaµÄbyte£¬²ÉÓÃIntÀ´½øÐд洢¡£
ͨ¹ýÈçÏ´úÂë´Óbyteµ½int½øÐÐת»»£º
/**
* from byte to int, because of byte in java is signed
*/
private static int toInt(int b) {
return b >= 0 ? (int)b : (int)(b + 256);
}
¶ÔÓÚÏÂÃæC#µÄ´úÂ룺
private static AuthenticationTicket fromByteArray(byte[] buf)
{
MemoryStream ms = new MemoryStream(buf);
BinaryReader reader = new BinaryReader(ms);
short version = reader.ReadInt16();
short scope = reader.ReadInt16();
int key = reader.ReadInt32();
}
¸ÄдΪÈçÏÂÐÎʽ£¬Ï൱ÓÚÖØÐÂʵÏÖBinaryReaderµÄReadInt16ºÍReadInt32·½·¨¡£
private static AuthenticationTicket fromByteArray(int[] bufInt)
{
int version = readInt16(bufInt);
int scope = readInt16(bufInt);
long key = readInt32(bufInt);
}

private static int readInt16(int[] bufInt) {
int i = 0;
for(int j = 0; j < 2; readArrayIndex++, j++) {
i += bufInt[readArrayIndex] << (j << 3);
}
return i;
}
private static long readInt32(int[] bufInt) {
long i = 0;
for(int j = 0; j < 4; readArrayIndex++, j++) {
i += bufInt[readArrayIndex] << (j << 3);
}
return i;
}
ÉÏÃæµÄÀý×Ó˵Ã÷£¬c#ºÍJavaËäÈ»·Ç³£ÏàÏñ£¬µ«ÊÇһЩ¹Ø¼üϸ½ÚµÄ²»Í¬ÊÇÐèÒª×Ðϸ¿¼Âǵġ£


Ïà¹ØÎĵµ£º

¹ØÓÚjavaµÄhttpЭÒéÎļþÉÏ´«ÊµÓÃÀýÌâÒ»

¹ØÓÚjavaµÄhttpЭÒéÎļþÉÏ´«ÊµÓÃÀýÌâÒ»
(2006-07-25 16:43:56)
×ªÔØ

 

·ÖÀࣺ
java
¹ØÓÚjavaµÄhttpЭÒéÉÏ´«:(¼òµ¥ÊµÓöøÇÒ½¡×³;ËÙ¶È¿ì)
´Ë·½·¨±ÈapacheµÄÎļþÉÏ´«°ü(uploadfile1.1:¾ÍÎļþÉÏ´«¹¦ÄܶøÑÔ)Ҫǿ¶àÁË
1.Ö»ÐèÒªÒ»¸öMultipartRequest.java»ù±¾Îļþ¾ÍÐС£
2.ǰ̨htmlµÄ»ù±¾¸ñʽ
<html ......

java²¹Âë ·´Âë

¹Ø¼ü×Ö: µ×²ãÊý¾Ý Ãû´Ê½âÊÍ£º ²¹Â룺1 ÔÚ¼ÆËã»úϵͳÖУ¬ÊýÖµÒ»ÂÉÓв¹ÂëÀ´±íʾ(´æ´¢). ʹÓò¹Âë,¿ÉÒÔ½«·ûºÅλºÍÆäËûλͳһ´¦Àí;ͬʱ,¼õ·¨Ò²¿É°´¼Ó·¨À´´¦Àí.ÁíÍâ,Á½¸öÓò¹Âë±íʾµÄÊý¾ÝÏà¼Óʱºò,Èç¹û×î¸ßλ(·ûºÅλ)ÓнøÎ»,Ôò½øÎ¥±»ÉáÆú. 2 ²¹ÂëÓëÔ­ÂëµÄת»»¹ý³Ì¼¸ºõÊÇÏàͬµÄ ÊýÖµµÄ²¹Âë±íʾҲ·ÖÁ½ÖÖÇé¿ö£º £¨1£©ÕýÊýµÄ²¹Âë:ÓëÔ ......

[Java Generics] get T.Class from T

 
/**
 * Copyright (c) 2010 IBOBO Corporation. All Rights Reserved.
 */
package com.ibm.util.dao.hib;
/**
 * [Java Generics] get T.Class from <T>
 * 
 * @author <a ......

JAVA³£ÓòÙ×÷Óï¾ä ÏîÄ¿ÖеÄ×ܽáÁù


ÅжÏÒ»¸öÎļþÊÇ·ñΪ¶þ½øÖÆÎļþ
public static boolean isBinary(File file) {
boolean isBinary = false;
try {
FileInputStream fin = new FileInputStream(file);
long len = file.length();
  for (int j = 0; j < (int) len; j++) {
int t = fin.read();
......

Java ME Mapdigit UI Toolkit ¼ò½é

ÔÚSUNÍÆ³ö LWUIT¿ª·¢°ü֮ǰ£¬ÔÚJava MEƽ̨ÉÏ¿ª·¢Óû§½çÃæ²¢²»ÊÇÒ»¼þÈÝÒ×µÄÊ£¬ÓÈÆäÊÇÏë×ö³öºÜÑ£µÄ½çÃæ£¬¸üÊÇÄÑÉϼÓÄÑ£¬ÕâÊÇÒòΪÓÉMIDP±¾ÉíÌṩµÄÓû§½çÃæÔªËØ£¬°üjavax.microedition.lcdui
ÖÐÌṩµÄ×é¼þ¹¦ÄÜÏà¶Ô¼òµ¥¡£
ʹÓà LWUIT ¿ª·¢°ü£¬¿ª·¢ÈËÔ±²»ÔÙÐèÒª±àдÓëÉ豸ÆÁÄ»´óСÏà¹ØµÄ´úÂ룬Ëü²ÉÓÃÁËÓëSwing ÏàËÆµÄ¸ÅÄîÌá ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ