java file io
ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀà
×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀ඼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch,int off,int
length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½·¨£¬ReaderÖÐread(char[] ch,int off,int length)ºÍclose()·½·¨ÊdzéÏó·½·¨¡£×ÓÀàÓ¦¸Ã·Ö±ðʵÏÖËûÃÇ¡£
¡¡¡¡µ±ÎÒÃǶÁдÎı¾ÎļþµÄʱºò£¬²ÉÓÃReaderÊǷdz£·½±ãµÄ£¬±ÈÈçFileReader£¬InputStreamReaderºÍBufferedReader¡£ÆäÖÐ×îÖØÒªµÄÀàÊÇInputStreamReader£¬
ËüÊÇ×Ö½Úת»»Îª×Ö·ûµÄÇÅÁº¡£Äã¿ÉÒÔÔÚ¹¹ÔìÆ÷ÖØÖ¸¶¨±àÂëµÄ·½Ê½£¬Èç¹û²»Ö¸¶¨µÄ»°½«²ÉÓõײã²Ù×÷ϵͳµÄĬÈϱàÂ뷽ʽ£¬ÀýÈçGBKµÈ¡£µ±Ê¹ÓÃFileReader¶ÁÈ¡Îļþ
µÄʱºò¡£
view plaincopy to clipboardprint?
FileReader fr = new FileReader("ming.txt");
int ch = 0;
while((ch = fr.read())!=-1 )
{
System.out.print((char)ch);
}
FileReader fr = new FileReader("ming.txt");
int ch = 0;
while((ch = fr.read())!=-1 )
{
System.out.print((char)ch);
}
ÆäÖÐread()·½·¨·µ»ØµÄÊǶÁÈ¡µÃϸö×Ö·û¡£µ±È»ÄãÒ²¿ÉÒÔʹÓÃread(char[] ch,int off,int length)ÕâºÍ´¦Àí¶þ½øÖÆÎļþµÄʱºòÀàËÆ£¬²»¶à˵ÁË¡£Èç¹ûʹÓÃ
InputStreamReaderÀ´¶ÁÈ¡ÎļþµÄʱºò
while((ch = isr.read())!=-1)
{
System.out.print((char)ch);
}
ÕâºÍFileReader²¢Ã»ÓÐʲôÇø±ð£¬ÊÂʵÉÏÔÚFileReaderÖеķ½·¨¶¼ÊÇ´ÓInputStreamReaderÖм̳йýÀ´µÄ¡£read()·½·¨ÊDZȽϺ÷Ñʱ¼äµÄ£¬Èç¹ûΪÁËÌá¸ßЧÂÊ
ÎÒÃÇ¿ÉÒÔʹÓÃBufferedReader¶ÔReader½øÐаü×°£¬ÕâÑù¿ÉÒÔÌá¸ß¶ÁÈ¡µÃËٶȣ¬ÎÒÃÇ¿ÉÒÔÒ»ÐÐÒ»ÐеĶÁÈ¡Îı¾£¬Ê¹ÓÃreadLine()·½·¨¡£
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("ming.txt")));
String data = null;
while((data = br.readLine())!=null)
{
System.out.println(data);
}
µ±ÄãÃ÷°×ÁËÈçºÎÓÃReaderÀ´¶ÁÈ¡Îı¾ÎļþµÄʱºòÄÇôÓÃWriterдÎļþͬÑù·Ç³£¼òµ¥¡£ÓÐÒ»µãÐèҪעÒ⣬µ±ÄãдÎļþµÄʱºò£¬ÎªÁËÌá¸ßЧÂÊ£¬Ð´ÈëµÄÊý¾Ý»áÏÈ
·ÅÈ뻺³åÇø£¬È»ºóдÈëÎļþ¡£Òò´ËÓÐʱºòÄãÐèÒªÖ÷¶¯µ÷ÓÃflush()·½·¨¡£ÓëÉÏÃæ¶ÔÓ¦µÄдÎļþµÄ·½·¨Îª£º
view plaincopy to clipboardprint?
&middo
Ïà¹ØÎĵµ£º
charÔÚjavaÖгÆΪ“×Ö·ûÐÍ” Õ¼2¸ö×Ö½Ú
×Ö·û³£Á¿ÊÇÓõ¥ÒýºÅÀ¨ÆðµÄÒ»¸ö×Ö·û ÇÒ×Ö·û³£Á¿ÔÚÄÚ´æÖд洢µÄÊǸÃ×Ö·ûÔÚUnicode×Ö·û¼¯ÖеÄÅÅÐòλÖ㬼´ÕûÊý
eg£ºchar x='a'
ÄÚ´æxÖд洢µÄÊÇ×Ö·ûaÔÚUnicode×Ö·û¼¯ÖеÄÅÅÐòλÖÃ97 Òò´ËÔÊÐí½«ÉÏÃæµÄÓï¾äд³Échar x=97;
ÓÉ´ËÀý¿ÉÒԵóöÒÔϽáÂÛ£º
1.Òª ......
package com.word.tools.pool;
import java.util.Vector;
import com.word.po.ObjectPool_Param;
import com.word.po.TyjkXmlPO;
public class TyjkXmlPool
{
/**¶ÔÏó³Ø²ÎÊý*/
private ObjectPool_Param ob_param;
/**´æ·Å¶ÔÏóµÄVector*/
......
ËäÈ»²»¾õµÃÔÚ±à³ÌʱÕýÈ·ÅжÏjavaÀà³õʼ»¯¹¤×÷ÏȺó˳Ðò»áÊÇÒ»¸öÌôÕ½£¬ÇÒ¶ÔÓÚÀà³õʼ»¯µÄÈÏʶ»¹Ö»Í£ÁôÔÚÓïÑÔÌØÐÔ»úÖƵIJãÃæ(»òÐí»áÊÇÒ»ÖÖʵÏÖ¼¼ÇÉÁìÓòµÄÒéÌâ)£¬µ«¶ÔÓÚ¹ØÓÚ³õʼ»¯ÕâÀàÁãÉ¢¶øÓÖϸСµÄ֪ʶµã£¬×ܽỹÊÇÓмÛÖµµÄ ......
instanceofÊÇJavaµÄÒ»¸ö¶þÔª²Ù×÷·û£¬ºÍ==£¬>£¬<ÊÇͬһÀණ¶«¡£ÓÉÓÚËüÊÇÓÉ×Öĸ×é³ÉµÄ£¬ËùÒÔÒ²ÊÇJavaµÄ±£Áô¹Ø¼ü×Ö¡£ËüµÄ×÷ÓÃÊDzâÊÔËü×ó±ßµÄ¶ÔÏóÊÇ·ñÊÇËüÓұߵÄÀàµÄʵÀý£¬·µ»ØbooleanÀàÐ͵ÄÊý¾Ý¡£¾Ù¸öÀý×Ó£º
¡¡¡¡String s = "I AM an Object!";
¡¡¡¡boolean isObject = s instanceof Object;
¡¡¡¡ÎÒÃÇÉùÃ÷ÁËÒ»¸öStrin ......
ÍøÂçµÄ¸ÅÄî:Ï໥Á¬½Ó,¶ÀÁ¢×ÔÖ÷
ÍøÂçÓë·Ö²¼Ê½¼¯ÈºÏµÍ³µÄÇø±ð£ºÃ¿¸ö½Úµã¶¼ÊÇһ̨¼ÆËã»ú£¬¶ø²»ÊǸ÷ÖÖ¼ÆËã»úÄÚ²¿µÄ¹¦ÄÜÉ豸¡£
Ip:¾ßÓÐÈ«ÇòΨһÐÔ£¬Ïà¶ÔÓÚinternet£¬IPΪÂß¼µØÖ·£¬TCP/IPÍøÂçÖеÄÿ̨¼ÆËã»ú¶¼ÓÐΨһµÄµØÖ·--IPµØÖ·. Ψһ±êʾһ̨Ö÷»ú
ÔÚJavaÖÐ,ÓÐÒ»¸öÓÃÀ´´æ´¢internetµØÖ·µÄÀà½ÐInetAddress.
Àý:»ñÈ¡±¾» ......