Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: OutputStreamPath

Christopher Schultz

2007-03-01

Replies:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave,

Dave Newton wrote:
> --- Laurie Harper <laurie@(protected):
>>    URL res = Thread.currentThread()
>>       .getContextClassLoader()
>>       .getResource(pathToConfigurationFile);
>>    // Save the properties
>>    OutputStream out = new FileOutputStream(res);
>>    properties.store(out, "");
>
> Ooo, I didn't know that.
>
> Hopefully I'll never want to use it, but still really
> good to know! :)

I'm not sure where this will work. FileOutputStream doesn't accept a URL
as a constructor argument. I think it's something more involved like:

URL res = ...;
URLConnection conn = res.openConnection();
conn.setDoOutput(true);
OutputStream out = conn.getOutputStream();

...

Of course, you'd want lots of error checking, too.

It's still butt-ugly.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF52Oh9CaO5/Lv0PARAo7RAJ9PchB6c8AOOaFF0KnpxX64oQLuUgCgn6MU
qSffOgmCivXDNQOWS+0te/g=
=Lxay
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.