Importing [java.io.FileWriter] is not allowed

I'm getting an error "Importing [java.io.FileWriter] is not allowed" in my "driver". Is file I/O not allowed in drivers?

Alan

Hubitat's Groovy environment has a restricted "allowlist" of classes you can import, and as the message suggests, that is not one of them. This also seems like an extremely unlikely one for them to consider adding (they have been historically open to feedback but have a reasonable default set), given that file storage for apps and drivers has never been possible, and a hub-wide file storage space accessible exclusively from Rule Machine was recently added (but if people find good uses for it, my hunch is that this will eventually be expanded--via Hubitat-specific methods--to other apps and maybe drivers).

If you have a specific goal you are trying to achieve with this, perhaps someone can suggest an alternative if you provide more information. Otherwise, the above is the explanation for what you see.

Thanks for the info.

I've got a History in one of my drivers and I want to save this out to a file. From my research in community it seems it maybe likely in a app, but definitely not available in a driver!

For example Hubitat Package Manager and some of BPTWorld apps use HTTPGET. So maybe there is a future in my code.

Worse comes to worst, I will write to a temporary file on the Hub and transfer it down to my pc on a regular basis.

Alan