java 解密PDF格式文件
import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfEncryptor;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
PdfEncryptor
.encrypt(new PdfReader("1.pdf"), new FileOutputStream("Encrypted2.pdf"),
"Hello".getBytes(), "World".getBytes(), PdfWriter.AllowDegradedPrinting,
PdfWriter.STRENGTH128BITS);
// decrypt the file
PdfReader reader = new PdfReader("Encrypted2.pdf", "World".getBytes());
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("Decrypted1.pdf"));
stamper.close();
getEncryptionInformation("1.pdf", null);
getEncryptionInformation("Encrypted2.pdf", "World");
getEncryptionInformation("Decrypted1.pdf", "World");
}
public static void getEncryptionInformation(String filename, String ownerpassword)
throws Exception {
PdfReader reader;
if (ownerpassword == null)
reader = new PdfReader(filename);
else
reader = new PdfReader(filename, ownerpassword.getBytes());
System.out.println
相关文档:
这是一个用JAVA W3C DOM 进行XML操作的例子,包含了查询、增加、修改、删除、保存的基本操作。较完整的描述了一个XML的整个操作流程。适合刚入门JAVA XML操作的朋友参考和学习。
假设有XML文件:test1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
< ......
Bean Serializable Interface 的接口让BEAN可以串行化,将其变成一个可保存为以后使用的二进制流。当一个BEAN被系列化到磁盘上或者其他任何地方,其状态被保存起来,其中的属性值也不会改变。在BEAN的规范中,JSP并没有要求BEAN实现Serializable接口。但是,如果您希望自己控制您所创建的组件的serialization进程,或者您想 ......
转帖处:http://dong-java.javaeye.com/blog/375150
1。推荐使用Oralce比较新的10.2.0.3 JDBC Drivers。这个版本对比9.2的最大的好处是DriverManager.setLoginTimeout函数是起作用的。设置了这个参数,在恶劣的网络环境中就不会有连接数据库的函数长时间不返回的情况。
2。JDBC Developer!ˉs Guide and Refer ......
package org.bupt.test;
import java.util.ArrayList;
class MyResource {
ArrayList<Integer> arrList= new ArrayList<Integer>();
public MyResource(ArrayList<Integer> arrList) {
this.arrList = arrList;
&nbs ......