Java SEѧϰ_FileInputStreamºÍFileOutputStream
FileInputStreamºÍFileOutputStream
FileInputStream £º
ÓÃÓÚ˳Ðò·ÃÎʱ¾µØÎļþ£¬ÓÃÓÚ¶ÁÈ¡ÖîÈçͼÏñÊý¾ÝÖ®ÀàµÄÔʼ×Ö½ÚÁ÷£¬´Ó³¬ÀàInputStreamÖм̳ÐÁËread,closeµÈ·½·¨£¬¶ÔÎļþ½øÐвÙ×÷£¬²»Ö§³Ö·½·¨ºÍ·½·¨£®ËüµÄÁ½¸ö³£ÓõĹ¹Ôì·½·¨ÊÇ£º¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
FileInputStream(String filepath/*ÎļþµÄÈ«³Æ·¾¶*/);¡¡¡¡¡¡
¡¡FileInputStream(File fileObj/*ÃèÊö¸ÃÎļþµÄFile¶ÔÏó*/);¡¡¡¡
¡¡¡¡
¿ÉÒÔÓÃÕâÑùµÄ·½·¨¹¹ÔìÎļþÊäÈëÁ÷£º¡¡¡¡
(1)FileInputStream¡¡f1 = new FileInputStream("test.txt");
(2)File f =new File("test.txt");
FileInputStream f2 = new FileInputStream(f);
FileInputStreamÖØдÁ˳éÏóÀà InputStreamµÄ¶ÁÈ¡Êý¾ÝµÄ·½·¨£º
public int read //´Ó´ËÊäÈëÁ÷ÖжÁÈ¡Ò»¸öÊý¾Ý×Ö½Ú¡¡¡¡¡¡¡¡¡¡¡¡
public int read(byte[ ] b);//´Ó´ËÊäÈëÁ÷Öн«×î¶àb¸ö×Ö½ÚµÄÊý¾Ý¶ÁÈëÒ»¸ö byte Êý×éÖÐ
public int read(byte[] b,int off, int len);//´Ó´ËÊäÈëÁ÷Öн«×î¶àlen¸ö×Ö½ÚµÄÊý¾Ý¶ÁÈëbyte Êý×éÖÐ
Èç¹û¶ÁÈ¡Êý¾Ýʱ,ÊäÈëÁ÷½áÊø¾Í·µ»Ø-1.
FileOutputStream:
FileOutputStreamÓÃÓÚÏòÒ»¸öÎı¾ÎļþдÊý¾Ý£®ÓÃÓÚдÈëÖîÈçͼÏñÊý¾ÝÖ®ÀàµÄÔʼ×Ö½ÚµÄÁ÷,Ëü´Ó³¬ÀàOutputStreamÖм̳еȷ½·¨£®Ëü³£ÓõĹ¹Ôì·½·¨ÈçÏ£º
FileOutputStream(String filepath/*ÎļþµÄÈ«³Æ·¾¶*/)
FileOutputStream(File fileobj/*ÃèÊö¸ÃÎļþµÄ¶ÔÏó*/)
FileOutputStream(String filepath,boolean append/*Èç¹ûΪÕ棬ÎļþÒÔ×·¼Ó·½Ê½´ò¿ª£¬²»¸²¸ÇÒÑÓÐÎļþµÄÄÚÈÝ£¬Èç¹ûÊǼ٣¬Ôò¸²¸ÇÔÎļþµÄÄÚÈÝ*/)
FileOutputStream(File fileObj,boolean append)
FileOutputStreamµÄ´´½¨²»ÒÀÀµÎļþÊÇ·ñ´æÔÚ£®Èç¹ûfilepath±íʾµÄÎļþ²»´æÔÚFileOutputStreamÔÚ´ò¿ªÇ°¾Í´´½¨Ëü£®Èç¹ûÎļþ´æÔÚ£¬Ôò´ò¿ªËü£¬×¼±¸
Ïà¹ØÎĵµ£º
package game;
public class JieCeng {
public static void main(String[] args){
System.out.println(fun(10));
}
public static int fun(int n){
if(1==n)
return 1;
System.out.println( n * fun(n-1));
return ......
ÕâƪÎÄÕÂÌÖÂۺͲûÃ÷ÁËÌṩ JavaTM I/O ÐÔÄܵĶàÖÖ¼¼Êõ¡£´ó¶à¼¼ÊõΧÈƵ÷Õû´ÅÅÌÎļþ I/O,µ«ÊÇÓÐЩÄÚÈÝҲͬÑùÊʺÏÍøÂç I/O ºÍ´°¿ÚÊä³ö¡£µÚÒ»²¿·Ö¼¼ÊõÌÖÂ۵ײãµÄI/OÎÊÌ⣬ȻºóÌÖÂÛÖîÈçѹËõ£¬¸ñʽ»¯ºÍ´®Ðл¯µÈ¸ß¼¶I/OÎÊÌ⡣Ȼ¶øÕâ¸öÌÖÂÛûÓаüº¬Ó¦ÓÃÉè¼ÆÎÊÌ⣬ÀýÈçËÑË÷Ëã·¨ºÍÊý¾Ý½á¹¹£¬Ò²Ã»ÓÐÌÖÂÛϵͳ¼¶µÄÎÊÌ⣬ÀýÈçÎļþ¸ßËÙ»º³å ......
ÖÕÓÚÍê³ÉÁË´®¿ÚµÄ±àд£¬¹¦Äܼܺòµ¥£¬ÈçÏ£º
×ö³öÒ»¸ö¼òµ¥½çÃ棬Ïò´®¿Ú·¢ËÍÌض¨µÄÃüÁ´®¿ÚÉϽÓÓй©²âÊÔÓõĴ®¿ÚÉ豸£©£¬½ÓÊÕÉ豸·µ»ØµÄÊý¾ÝÔÚ½çÃæÉÏÏÔʾ£º
import gnu.io.CommPortIdentifier;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
import gnu.io.Ser ......
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁË
JavaÔËÐл·¾³£¨Java Runtime
Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕ
JDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJDKÊÇSun¹«Ë¾·¢²¼µÄJDK£¬³ýÁËSunÖ®Í⣬»¹Óк ......
³£³£ÐèÒªµÝ¹éµÄÌæ»»ÎļþÄÚÈÝ£¬Èç×î½üÎÒÏëдÁ˸öjEdit²å¼þ£¬jEditÌṩÁËÒ»¸ö²å¼þÄ£°å£¬ÎÒֻҪȫ²¿Ì滻һϾͳÉÁËÎÒ×Ô¼ºµÄ¹¤³Ì¡£ÔÚlinuxÏ£¬ÕâºÃ°ì£¬shellÀ´¸ã¶¨£¬µ«ÔÚWindowsÏ»òÕß²»ÊìϤshell¾ÍµÃÏëµãÆäËû°ì·¨À´°ìÁË£¬EditPlus¿ÉÒÔ£¬UEÒ²¿ÉÒÔ£¬²»¹ý²»Ì«·½±ãµÄÊÇÎļþÃû²»ºÃÌæ»»£¬ÒÔÇ°¸ø×Ô¼ºÐ´¹ýÒ»¸öС¹¤¾ßÀ´³ÉÅú¸ÄMP3µÄÃû×Ö£ ......