Reading a file using Java

import java.io.*;
import java.lang.String;
class FileInputStreamDemo{
public static void main(String args[])throws IOException{
int size;

InputStream f=new FileInputStream("FileInputStreamDemo.java");
System.out.println("Total available byte"+(size=f.available()));
int n=size/40;
OutputStream f0=new FileOutputStream("File1.txt");
System.out.println("first"+n+"byte of file read");
for(int i=0;i<n;i++){
System.out.println((String source[i]=(char)f.read()));

byte buf[i]=source.getBytes();

f0.write(buf);
}
f.close();
f0.close();

}
}

Related product you might see:

Share this product :

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. TECHBEAN stars - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger