[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1267
  • Last Modified:

How to convert a OutputStreamWriter to FileOutputStream/OutputStream ?

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
richardluo
Asked:
richardluo
1 Solution
 
SendohCommented:
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
 
richardluoAuthor Commented:
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
 
objectsCommented:
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
 
shyamkumarreddyCommented:
Hi Richard
U can use DataOutputStream and save in specified format.



Cheers
Shyam
0
 
shyamkumarreddyCommented:
Just checkup the Document for DataOutputStream


Cheers
Shyam
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now