struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: OutputStreamPath
Date Thu, 01 Mar 2007 23:37:06 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave,

Dave Newton wrote:
> --- Laurie Harper <laurie@holoweb.net> wrote:
>>      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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message