package com.jsl.io;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class ReadingFileContent {
public static void main(String[] args) {
FileInputStream fis=null;
BufferedInputStream bis=null;
FileOutputStream fos=null;
BufferedOutputStream bos=null;
try {
fis=new FileInputStream("One.txt");
bis=new BufferedInputStream(fis);
try{
fos=new FileOutputStream("Two.txt");
bos=new BufferedOutputStream(fos);
int ch;
while((ch=bis.read())!=-1){
fos.write((char)ch);
}
}catch(Exception e){
System.out.println("While opening new file :"+e);
}
} catch (Exception e) {
System.out.println("While reading the file");
}finally{
try {
bis.close();
fis.close();
bos.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Tuesday, August 21, 2012
Reading file and writing into another file
Subscribe to:
Post Comments (Atom)
Spring Boot 3 : JWT with SecurityFilterChain, AuthorizeHttpRequests, RequestMatchers
pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0...
-
Expression Language A primary feature of JSP technology version 2.0 is its support for an expression language (EL). An expres...
-
import java.util.List ; import java.util.Stack ; public class EvaluatingExpression { public static void main ( String [] arg...
No comments:
Post a Comment