?
Solved

How to convert a OutputStreamWriter to FileOutputStream/OutputStream ?

Posted on 2001-06-04
5
Medium Priority
?
1,218 Views
Last Modified: 2011-08-18
Hi,

  I have an OutputStreamWriter object, I need to convert this object to a FileOutputStream(or OutputStream) object, so I can pass the this object to Properties.store method.

Someone knows how to do it ?

Thanks

Richard

0
Comment
Question by:richardluo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:Sendoh
ID: 6154611
hi !
just wondering in order for u to create a OutputStreamWriter obj(y) u need a OutputStream obj(x) ...
so just store and pass that x to properties.store loh...

hope this helps...:)
0
 

Author Comment

by:richardluo
ID: 6154662
Hi,

  I need to create an OutputStream with encoding, OutputStream object itself doesn't allow u to put encoding, so I need to create OutputStreamWriter with encoding first, then pass that object to store...

Any suggestion ?

Richard
0
 
LVL 92

Accepted Solution

by:
objects earned 300 total points
ID: 6154691
The Properties class only understands a particular format, Latin 1 encoding, with non-ascii charaters converted to unicode format (\uxxxx).
So the short answer is you can't use a specified encoding to save (or load) properties files.

There is a tool available from Sun (native2ascii) which convert Unicode-encoded files to native-encoded and visa versa:

http://java.sun.com/j2se/1.3/docs/tooldocs/tools.html#intl
0
 
LVL 3

Expert Comment

by:shyamkumarreddy
ID: 6155071
Hi Richard
U can use DataOutputStream and save in specified format.



Cheers
Shyam
0
 
LVL 3

Expert Comment

by:shyamkumarreddy
ID: 6155072
Just checkup the Document for DataOutputStream


Cheers
Shyam
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question