package com.jsl.io;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.FileOutputStream;
public class FileCreation {
public static void main(String[] args) {
FileOutputStream fos = null;
BufferedOutputStream bos = null;
try {
fos = new FileOutputStream("One.txt", true);
System.out.println("Enter the text");
bos = new BufferedOutputStream(fos, 512);
DataInputStream dis = new DataInputStream(System.in);
char ch;
while ((ch = (char) dis.read()) != '@') {
int a = 1 / 0;
bos.write(ch);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bos.close();
fos.close();
} catch (Exception e) {
System.out.println("While closing the file :" + e);
}
}
System.out.println("End of main method");
}
}
Tuesday, August 21, 2012
Creating the file using FileOutputStream
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...
-
pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0...
No comments:
Post a Comment