Java ÍøÂç³ÌÐò
JavaÔÚÍøÂç±à³ÌÕâ¸öµØ·½×öµÄºÜºÃ£¬javaµÄÖ÷ҪĿµÄÒ²ÊÇΪÁËÍøÂç¶øÉúµÄ£¬ËüÄÜ·½±ãµÄ·ÃÎÊÍøÂçÉϵÄ×ÊÔ´¡£ÎÒÃÇÕâ½Ú¿ÎÀ´½éÉÜÍøÂçͨѶµÄÁ½ÖÖ»úÖÆ£ºURLͨÐÅ»úÖÆ£¬SocketͨÐÅ»úÖÆ¡£
URL±íʾÁËInternetÉÏÒ»¸ö×ÊÔ´µÄÒýÓûòµØÖ·¡£JavaÍøÂçÓ¦ÓóÌÐòÒ²ÊÇʹÓÃURLÀ´¶¨Î»Òª·ÃÎʵÄInternetµÄ×ÊÔ´¡£ÔÚjdkÀïÃæjava.net.URLÒ²ÊÇÒ»¸öÀ࣬ËüÀ´·â×°URLµÄһЩϸ½Ú¡£Ä¿Ç°´ó¼Ò¿ÉÒÔ°ÑURLÀí½âΪÍøÖ·£¬http://www.100jq.com/default.aspx Õâ¾ÍÊǸöURL¡£httpÊÇÐÒéÃû£¨³¬Îı¾´«ÊäÐÒ飩ÓÓ://”¸ô¿ªwww.100jq.com ÊÇÖ÷»úÃû¡£Default.aspxÊÇÎļþÃû¡£ËüµÄ¶Ë¿ÚºÅûÓÐд£¬Ä¬ÈÏÊÇ80¡£
ʵ¼ù£º
import java.net.*;
public class ParseURL {
public static void main(String[] args) throws MalformedURLException{
URL url = new URL("http://www.100jq.com:45175/default.aspx");
System.out.println("ÐÒéÊÇ "+url.getProtocol());
System.out.println("Ö÷»úÊÇ "+url.getHost());
System.out.println("ÎļþÃûÊÇ "+url.getFile());
System.out.println("¶Ë¿ÚºÅÊÇ "+url.getPort());
}}
/*
URLÕâ¸ö¶ÔÏóÖÐÌṩÁ˺ܶ෽·¨ÏñÊÇ
getProtocol()
getHost()
getFile()
getPort()
*/
ÎÒÃÇ¿ÉÒÔͨ¹ýURL¶ÔÎļþ»ò×ÊÔ´¶ÁÈ¡£¬Ò²¿ÉÒÔͨ¹ýURLConnection¶ÁÈ¡£¬Ò²¿ÉÒÔͨ¹ýÕâ¸öдÈëÊý¾ÝÏÞÓÚcgi½Å±¾¡£
ʵ¼ù£º
import java.net.*;
import java.io.*;
public class URLConnectionReader {
public static void main(String[] args) throws IOException {
URL google = new URL("http://www.100jq.com/");
URLConnection g = google.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(g.getInputStream()));
String inputLine;
while ((inputLine=in.readLine())!=null)
System.out.println(inputLine);
in.close();
}
}
URLºÍURLConnectionÀàÌṩÁ˽ϸ߲ã´ÎµÄÍøÂç·ÃÎÊ¡£ÓÐʱºòÐèÒª½øÐнϵͲã´ÎµÄ·ÃÎÊ¡£±àдC/SÄ£Ð͵ijÌÐòʱ£¬¾ÍҪʹÓÃSocketͨÐÅ»úÖÆÁË¡£ÒòΪÔÚÍøÂçÉϲ»Ò»¶¨·ÇµÃ·ÃÎÊÎļþ¡£
ʵ¼ù£º//ÏÈд¸ö¿Í»§¶ËµÄÓ¦ÓÃ
import java.net.*;
import java.io.*;
public class SimpleClient {
public static void main(String args[]) {
try {
// ÔÚ5432¶Ë¿Ú´ò¿ª·þÎñÆ÷Á¬½Ó
// ÔÚÕâÀïÓÃlocalhostÓë127.0.0.1ÊÇÒ»¸öÒâ˼
Socket s1 = new Socket("127.0.0.1", 5432);
// ¶ÔÕâ¸ö¶Ë¿ÚÁ¬½ÓÒ»¸öreader,×¢Òâ¶Ë¿Ú²»Äܹ»Õ¼ÓñðµÄ
Bu
Ïà¹ØÎĵµ£º
½Ó¿ÚÀࣺ
package JFFileEncrypt;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
/**
* ¹¦ÄÜ£º¶ÔÎļþ¼ÓÃܽâÃܲÙ×÷
* @author jiangfeng
*
&nbs ......
-
½üÈÕÔÚ±à³ÌÖÐÓõ½½Ó¿Ú֪ʶ,ÓÉÓڿα¾ÖжԽӿÚÃèÊö½ÏÉÙ,ËùÒÔÏë´ÓÍøÉϲéÕÒ×ÊÁÏ,µ«ÍøÉϵÄ×ÊÁÏ´ó¶àÒ²Ö»ÊÇÈß³¤µÄÃèÊö,ËùÒÔÔÚ´ËÌṩһ×Ô¼ºÐ´µÄʵÀý,¹©´ó¼Ò²Î¿¼:
ÔÌâÊÇÕâÑùµÄ£ºÔÚjavaÖУ¬¶¨ÒåÒ»¸ö½Ó¿Ú£¬ÉùÃ÷¼ÆË㳤·½ÐÎÃæ»ýºÍÖܳ¤µÄ³éÏó·½·¨£¬ÔÙÓÃÒ»¸öÀàȥʵÏÖÕâ¸ö½Ó¿Ú£¬ÔÙ±àдһ¸ö²âÊÔÀàȥʹÓÃÕâ¸ö½Ó¿Ú¡£
Ê×ÏÈ£¬½Ó¿Ú±ØÐ ......
һЩ³õѧJAVAµÄÅóÓÑ¿ÉÄÜ»áÓöµ½JAVAµÄÊý¾ÝÀàÐÍÖ®¼äת»»µÄ¿àÄÕ£¬ÀýÈ磬ÕûÊýºÍfloat,doubleÐÍÖ®¼äµÄת»»£¬ÕûÊýºÍStringÀàÐÍÖ®¼äµÄת»»£¬ÒÔ¼°´¦Àí¡¢ÏÔʾʱ¼ä·½ÃæµÄÎÊÌâµÈ¡£ÏÂÃæ±ÊÕ߾Ϳª·¢ÖеÄһЩÌå»á½éÉܸø´ó¼Ò¡£
ÎÒÃÇÖªµÀ£¬JavaµÄÊý¾ÝÀàÐÍ·ÖΪÈý´óÀ࣬¼´²¼¶ûÐÍ¡¢×Ö·ûÐͺÍÊýÖµÐÍ£¬¶øÆäÖÐÊýÖµÐÍÓÖ·ÖΪÕûÐͺ͸¡µãÐÍ£»Ïà¶Ô ......
Èí»Ø³µ£¨Soft Return£©£ºÈí»Ø³µÊÇÔÚ×Ö´¦Àí³ÌÐòÖÐ×÷Ϊ×Ô¶¯ÒÆÐй¦ÄܵÄÒ»²¿·Ö×Ô¶¯²åÈëµÄ£¬Ò²½Ð»»Ðзû£¬ÔÚwordÖп´²»¼û¡£Èç¹ûÎı¾
Ò»Ðеij¤¶È³¬¹ýÎĵµËù¶¨ÒåµÄÓұ߾àʱ£¬¼´µ±Ç°ÐÐûÓÐ×ã¹»µÄ¿Õ¼ä·ÅÖÃÏÂÒ»¸ö×Ö·ûʱ£¬ÎÄ×Ö´¦ÀíÈí¼þ½«ÔÚÕâÒ»ÐÐÎı¾µÄĩβ×Ô¶¯²åÈëÒ»
¸öÈí»Ø³µ·û£¬Îı¾ÁíÆðÒ»ÐС£Õâ¸öÈí»Ø³µ·ûÊÇÓɱ༳ÌÐò×Ô¶¯² ......