Would you like to react to this message? Create an account in a few clicks or log in to continue.

Stream I/O 2 Ẻ byte Stream character Stream

 :: ¹ҡѹ :: File Stream

Go down

Stream I/O 2 Ẻ  byte Stream  character Stream Empty Stream I/O 2 Ẻ byte Stream character Stream

ตั้งหัวข้อ  Admin Fri May 23, 2008 10:38 am

byte Stream

ҹҡ c://test.txt
¹ c://testCopy.txt
ѧࡵ :// ФѺ
package fileIO;

import java.io.*;

public class Byte1 {

public static void main(String [] args) {

int bRead=0;
int index=0;

try{

FileInputStream inF = new FileInputStream("c://test.txt");
FileOutputStream outF = new FileOutputStream("c://testCopy.txt");

byte b[] = new byte[99];

while(index !=-1){
index = inF.read();

if(index !=-1){
outF.write(index);
//bRead++;
}// if

}// while

inF.close();
outF.close();


File file = new File("c://testCopy.txt");

FileInputStream in = new FileInputStream(file);
// byte show[] = new byte[20];

System.out.println("---------------------------------------");
int ii = 0;
while(ii != -1){
ii = in.read();
System.out.println(ii);
}// while

}catch (IOException e) {
System.out.println(" Error is : "+e.toString());
}

}

}
Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน


 :: ¹ҡѹ :: File Stream

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ