You are on page 1of 2

***STREAM---Luong du lieu

vao ra thong qua tream.


-----
Stream bao gom :
1. Lop InputStream
2. Lop OutputStream
-----
1. InputStream (doc du lieu ) chia ra:
1.1: FileInputStream --> doc data tu file
1.2: BufferderInputStream -->dung doc data tu mot Stream khac, tang toc
do doc vi co Buff
vd: FileInputStream fis = new FileInputStream( D:/test.txt );
BufferedInputStream bis = new BufferedInputStream(fis);
1.3: ObjectInputStream --> dung doc data tu mot Object Stream
1.4: DataInputStream -->lop nay dung doc nhung du lieu primitive (du lie
u cu , xua)
vd: try{
FileInputStream fis = new FileInputStream( D:/double.dat );
DataInputStream dis = new DataInputStream(fis);
while(dis.available()>0){
double d = dis.read();
System.out.println(d);
}catch(...){..}

-----
2. OutputStream (ghi data ) chia ra:
1.1: FileOutputStream
1.2: BufferderOutputStream
1.3: ObjectOutputStream
1.4: DataOutputStream

---------------------
Doc Ghi
+Doc
ta dung InputStream.
cu the nhu sau:
cach 1:
FileInputStrteam fis=null;
fis=new FileInputStream("dg dan file");
cach 2:
-FileInputStream fis =new FileInputStream("dung dan toi fiile");
+Ghi
ta dung OutputStream
Cu the ta dung:
-FileOutputStream fos=new FileOutputStream("...");
.......
---
***I | O Text file (vao ra trong file text)
su dung lop BufferedReader dde doc file text va PrintWriter dde ghi vao file te
xt.

You might also like