How to set password to a document using OOo API

Hi All,
I need help and my requirement is setting password to my open office document with out opening using OOo API using java program.
I need help and my requirement is setting password to my open office document with out opening using OOo API using java program.