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...
-
Installation of MongoDB The executable file needs to be downloaded from: https://www.mongodb.com/download-center?jmp=nav#communit...
-
Form to add multiple rows: <! DOCTYPE html> <%@ page language = "java" contentType = "text/html; cha...
No comments:
Post a Comment