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ËäÈ»·Ç³£ÏàÏñ£¬µ«ÊÇһЩ¹Ø¼üϸ½ÚµÄ²»Í¬ÊÇÐèÒª×Ðϸ¿¼Âǵġ£
Ïà¹ØÎĵµ£º
¹Ø¼ü×Ö: µ×²ãÊý¾Ý Ãû´Ê½âÊÍ£º ²¹Â룺1 ÔÚ¼ÆËã»úϵͳÖУ¬ÊýÖµÒ»ÂÉÓв¹ÂëÀ´±íʾ(´æ´¢). ʹÓò¹Âë,¿ÉÒÔ½«·ûºÅλºÍÆäËûλͳһ´¦Àí;ͬʱ,¼õ·¨Ò²¿É°´¼Ó·¨À´´¦Àí.ÁíÍâ,Á½¸öÓò¹Âë±íʾµÄÊý¾ÝÏà¼Óʱºò,Èç¹û×î¸ßλ(·ûºÅλ)Óнøλ,Ôò½øÎ¥±»ÉáÆú. 2 ²¹ÂëÓëÔÂëµÄת»»¹ý³Ì¼¸ºõÊÇÏàͬµÄ ÊýÖµµÄ²¹Âë±íʾҲ·ÖÁ½ÖÖÇé¿ö£º £¨1£©ÕýÊýµÄ²¹Âë:ÓëÔ ......
»ñµÃmysqlºÍoracleÁ´½ÓµÄÀà
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectDB {
private static final String MYSQL = "jdbc:mysql://";
private static final String ORACLE = "jdbc:oracle:thin:@";
private ConnectD ......
ÎÒÃÇΪʲôҪȥÃæÊÔ ? ÃæÊÔµÄÄ¿µÄÊÇʲô ?
ÃæÊÔÒª½â¾öÄļ¸¸öÎÊÌâ ?
Ò»¡¢ÃæÊÔµÄÄ¿µÄ
¶þ¡¢ÃæÊÔÇ°µÄ×¼±¸
Èý¡¢ÃæÊÔ³£¼ûÎÊÌâ½â´ð
A¡¢ÏîÄ¿¾Àí³£¼ûÎÊÌâ
B ......
ƪÎÄÕÂÊÇ×î½ü¸Õ¿´µ½µÄ£¬ËäÈ»ÊÇ˵³ÌÐòÔ±´ÓC++תJAVAÐèҪעÒâµÄµØ·½£¬µ«ÊǺÜÏêϸµÄ˵³öÁËC++ºÍJAVAµÄ²»Í¬µÄµØ·½£¬¶ÔÓÚJAVAÖÐΪʲôûÓÐÖ¸Õ롢ΪʲôûÓÐÄÚ´æй¶¡¢½Ó¿ÚºÍC++ÖжàÖؼ̳еĹØϵ¡¢Òì³£»úÖƵÈÎÊÌâÒ²ÃèÊöµÄºÜÏêϸ£¬¹ÊתÔعýÀ´¡£
1.JavaÔÚÐéÄâ»úÉÏÔËÐÐ
JavaÔ´´úÂë²¢²»ÊDZ»±àÒë³ÉΪÆÕͨµÄ»úÆ÷´úÂë¡£¶øÊDZ»·Òë³ÉÎ ......
ÔÚEclipseÖÐÁ¬ÉÏjavadocsÎĵµ
Ò»¡¢ °²×°Eclipse
¶þ¡¢ ´ÓOracle¹ÙÍø»òÕßsunÒÔÇ°µÄ¹ÙÍøÉÏÏÂÔØJavaÏàÓ¦µÄdocsÎĵµ
Èý¡¢ & ......