check for file corruption or password protection using java?

Hi,
I am new to LO and just trying to wrap my head around it.

I have a project where I need to be able to test many file formats, including old ones like .doc and Word Perfect, for corruption and password protection. I would be calling lo from a java app.

I realize LO has a ton more functionality than that but there are few tools out there that handle the number file types and are free to use commercially.

Any pointers on how to implement this with LO or better tool recommendations would be greatly appreciated.

Jay