【在java中创建受密码保护的文件】教程文章相关的互联网学习教程文章

java-如何使用Apache Poi检查xlsx文件是否受密码保护【代码】

如何检查xlsx文件是否受密码保护.我们可以如下检查xls文件FileInputStream fin = new FileInputStream(new File("C:/Book1.xls"));POIFSFileSystem poifs = new POIFSFileSystem(fin);EncryptionInfo info = new EncryptionInfo(poifs);Decryptor d = Decryptor.getInstance(info);try {if (!d.verifyPassword(Decryptor.DEFAULT_PASSWORD)) {throw new RuntimeException("Unable to process: document is encrypted");}InputStrea...