JavaÖÐInputstreamÓëReaderµÄÇø±ð
JavaÖÐInputstreamÓëReaderµÄÇø±ð
ReaderÖ§³Ö16λµÄUnicode×Ö·ûÊä³ö£¬InputStreamÖ§³Ö8λµÄ×Ö·ûÊä³ö¡£
ReaderºÍInputStream·Ö±ðÊÇI/O¿âÌṩµÄÁ½Ì×ƽÐжÀÁ¢µÄµÈ¼¶»ú¹¹£¬
InputStream¡¢OutputStreamÊÇÓÃÀ´´¦Àí8λԪµÄÁ÷£¬
Reader¡¢WriterÊÇÓÃÀ´´¦Àí16λԪµÄÁ÷¡£
¶øÔÚJAVAÓïÑÔÖУ¬byteÀàÐÍÊÇ8λµÄ£¬charÀàÐÍÊÇ16λµÄ£¬ËùÒÔÔÚ´¦ÀíÖÐÎĵÄʱºòÐèÒªÓÃReaderºÍWriter¡£
ÖµµÃ˵Ã÷µÄÊÇ£¬ÔÚÕâÁ½Öֵȼ¶»ú¹¹Ï£¬»¹ÓÐÒ»µÀÇÅÁºInputStreamReader¡¢OutputStreamWriter¸ºÔð½øÐÐInputStreamµ½ReaderµÄÊÊÅäºÍÓÉOutputStreamµ½WriterµÄÊÊÅä¡£
java.io.Reader ºÍ java.io.InputStream ×é³ÉÁË JavaÊäÈëÀà¡£Reader ÓÃÓÚ¶ÁÈë16λ×Ö·û£¬Ò²¾ÍÊÇ Unicode±àÂëµÄ×Ö·û£»¶ø InputStream ÓÃÓÚ¶ÁÈë ASCII×Ö·ûºÍ¶þ½øÖÆÊý¾Ý¡£
ÔÚ JavaÖУ¬Óв»Í¬ÀàÐ굀 Reader ÊäÈëÁ÷¶ÔÓ¦ÓÚ²»Í¬µÄÊý¾ÝÔ´£º
FileReader ÓÃÓÚ´ÓÎļþÊäÈ룻
CharArrayReader ÓÃÓÚ´Ó³ÌÐòÖеÄ×Ö·ûÊý×éÊäÈ룻
StringReader ÓÃÓÚ´Ó³ÌÐòÖеÄ×Ö·û´®ÊäÈ룻
PipedReader ÓÃÓÚ¶ÁÈ¡´ÓÁíÒ»¸öÏß³ÌÖÐµÄ PipedWriter дÈë¹ÜµÀµÄÊý¾Ý¡£
ÏàÓ¦µÄÒ²Óв»Í¬ÀàÐ굀 InputStream ÊäÈëÁ÷¶ÔÓ¦ÓÚ²»Í¬µÄÊý¾ÝÔ´£ºFileInputStream£¬ByteArrayInputStream£¬StringBufferInputStream£¬PipedInputStream¡£ÁíÍ⣬»¹ÓÐÁ½ÖÖûÓжÔÓ¦ Reader ÀàÐ굀 InputStream ÊäÈëÁ÷£º
Socket ÓÃÓÚÌ×½Ó×Ö£»
URLConnection ÓÃÓÚ URL Á¬½Ó¡£
ÕâÁ½¸öÀàʹÓà getInputStream() À´¶ÁÈ¡Êý¾Ý¡£
ÏàÓ¦µÄ£¬java.io.Writer ºÍ java.io.OutputStream Ò²ÓÐÀàËƵÄÇø±ð¡£
Ïà¹ØÎĵµ£º
È·¶¨ÄãµÄjdk»·¾³±äÁ¿ÅäÖÃÊÇÕýÈ·µÄ¡£
¶ÔÓÚjava³õѧÕßÀ´Ëµ£¬±àÒëºÍÔËÐÐjava³ÌÐòÊÇÒ»¼þºÜÍ·Ì۵Ķ«Î÷¡£
ÏÔÈ»£¬ÔÚÃüÁʽϱàÒëºÍÔËÐÐjava³ÌÐòÓþÃÁË£¬È·ÊµÊǺÜÂé·³£¬
¶øÎÒÃÇÓÖ²»ÏëʹÓôóÐ͵Ŀª·¢¹¤¾ßʱ£¬UltraEditÊÇÒ»¸ö²»´íµÄÑ¡Ôñ£¬
ºÜ¶à³õѧÕ߶¼ÊÇÓÃËüÀ´±àдjavaÔ´ÎļþµÄ£¬¿ÉÒÔ¸ßÁÁ¶ÈÏÔʾ¹Ø¼ü×Ö¡£
1¡£¹Ø¼ü×Ö¸ßÁÁ¶ÈÏÔʾ¡ ......
JAVAÖÐStringÓëStringBuffer ¡¢StringBuilderµÄÇø±ð
Ò»¡¢StringºÍStringBufferµÄÇø±ð
ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊǿɱäÀà¡£
StringÊôÐÔ:
*ÊǶÔÏó²»ÊÇÔʼÀàÐÍ.
*Ϊ²»¿É±ä¶ÔÏó,Ò»µ© ......
1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii¡ ......
ÒÔÏÂÊÇÐèÒª»ñµÃÅäÖÃÎļþµÄÀ࣬ÆäÖлñµÃ /config.properties ÎļþµÄÊý¾Ý
package com.chinacache.boss.queryservice.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.log4j.Logger;
public final class ConfigConstant {
static Logger logg ......
xmlÎļþÄÚÈÝ£º
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel switchTime="20080101000101" k="1.07" n="6" s="55" channelId="0404" channelName="xxxx.xxxx.xxx.cn"/>
<channel switchTime="20080301010101" k="1.07" n="6" s="55" channelId="0405" channelName="xxx ......