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();
}
}
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();
}
}
Post a Comment