Comment on Tutorial - FileInputStream - sample program in Java By Sam Chen
Comment Added by : anne
Comment Added at : 2011-11-22 10:50:10
Comment on Tutorial : FileInputStream - sample program in Java By Sam Chen
You can save a file from the content of the input. This is my method to do it.
public static void SaveText() throws FileNotFoundException {
try {
System.out.println("Enter the string");
Scanner ip = new Scanner(System.in);
String str = ip.nextLine();
ip.close();
byte[] source = str.getBytes();
FileOutputStream fos = new FileOutputStream("D:/test.txt");
fos.write(source);
System.out.println("Finished");
} catch (IOException ex) {
Logger.getLogger(Q2.class.getName()).log(Level.SEVERE, null, ex);
}
}
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. insert a value in excel is not a problem but inser
View Tutorial By: durga at 2010-03-05 23:08:02
2. nice tutorial,but if provided with the complete ex
View Tutorial By: Prasant Kumar Sahu at 2013-01-07 13:17:20
3. How can i download the comm.API .
pls tel
View Tutorial By: Sajeer kc at 2015-01-16 04:12:28
4. Thanks :)
View Tutorial By: Soorej at 2010-11-23 23:43:27
5. i totally disagree with Gerardo SaldÃv
View Tutorial By: Shivesh at 2009-09-24 23:46:42
6. Thank you very much for your help!!
View Tutorial By: Ajay Singh at 2009-10-21 22:17:21
7. tis s very useful and easy to capture all persons
View Tutorial By: Divya at 2013-12-19 05:42:32
8. I made this "In your AndroidManifest.xml file
View Tutorial By: lalo at 2011-11-20 05:56:43
9. Can you Please send me the code for movable clock
View Tutorial By: Rajagopal at 2008-09-29 23:10:57
10. for ex
public class test()
{
View Tutorial By: Anundhara at 2012-08-11 06:54:57