473,378 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Writing in a file

77
I have an OutputStream(BufferedOutputStream), and a fileName to write.

How can write the content of this bufferedOutputStream object into the file ?
Dec 6 '07 #1
4 1222
r035198x
13,262 8TB
I have an OutputStream(BufferedOutputStream), and a fileName to write.

How can write the content of this bufferedOutputStream object into the file ?
The API specs have two overloaded write methods.
Out of interest, what type of data(character or binary) are you writing to this file?
Dec 6 '07 #2
pjerald
77
The API specs have two overloaded write methods.
Out of interest, what type of data(character or binary) are you writing to this file?
Contains only string data..
Thanks,
Jerald.
Dec 6 '07 #3
pjerald
77
Contains only string data..
Thanks,
Jerald.
See
Expand|Select|Wrap|Line Numbers
  1.     OutputStream os = response.getOutputStream();
  2.     generateVCard(os,dataObject);
  3.         System.err.println("test : os =="+os);
  4.        // This os now have the data which should be written in a file.
  5.     FileOutputStream fos = new FileOutputStream(new File(fileName));
  6.     fos.DONTKNOW_WHAT_TO_DO ?
  7.  
  8.  
Dec 6 '07 #4
See
Expand|Select|Wrap|Line Numbers
  1.     OutputStream os = response.getOutputStream();
  2.     generateVCard(os,dataObject);
  3.         System.err.println("test : os =="+os);
  4.        // This os now have the data which should be written in a file.
  5.     FileOutputStream fos = new FileOutputStream(new File(fileName));
  6.     fos.DONTKNOW_WHAT_TO_DO ?
  7.  
  8.  
you are almost there. If you look at the API, you can see there is an option to wrap the FileOutputStream "fos" in a FileWriter and calling the write() method. THat's all you need. REad THe FileWriter specs from the API

Regards
Dec 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
6
by: Sebastian Kemi | last post by:
How should a write a class to a file? Would this example work: object *myobject = 0; tfile.write(reinterpret_cast<char *>(myobject), sizeof(*object)); / sebek
3
by: ishekar | last post by:
Hi, I have an application where i want to write data to a file, the data is being sent from an external source. I know the total size of the data and then i retrieve the data in small segments...
1
by: Daniel | last post by:
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a...
2
by: melanieab | last post by:
Hi, I'm trying to store all of my data into one file (there're about 140 things to keep track of). I have no problem reading a specific string from the array file, but I wasn't sure how to...
4
by: HNguyen | last post by:
Hi, I have a Web application in ASP.NET. My Application allows the users upload files into the server after checking their user names and passwords. For each transaction, the Web program will...
0
by: Yunus's Group | last post by:
Yunus's Group May 23, 3:36 pm show options Newsgroups: microsoft.public.dotnet.languages.vb From: "Yunus's Group" <yunusasm...@gmail.com> - Find messages by this author Date: 23 May 2005...
16
by: Claudio Grondi | last post by:
I have a 250 Gbyte file (occupies the whole hard drive space) and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain...
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
3
by: Barry Flynn | last post by:
Hi I am working with a VB 2005 program which has been converted from VB6. It writes data out to a flat file, with code like the following line WriteLine(riFileNo, "Hist", lsAssetID,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.