易截截图软件、单文件、免安装、纯绿色、仅160KB

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:用多线程实现时间的动态显示

import java.awt.*;
import javax.swing.*;
import java.util.Date;
import java.awt.*;
class Time extends JFrame implements Runnable{//实现接口
Thread clockThread;
   JLabel jLabel=new JLabel();
   public Time()
   {
   Container con=this.getContentPane() ......

JDK中包含的常用Java调试工具

1  JDK5.0包括的调试工具
我们在这里对JDK5.0的调试工具做大致的概念性的介绍,然后希望通过介绍我自己在实际工作中使用这些工具解决问题的实例来让大家对这些工具有更深入的了解。
 
 JDK5.0里面加入了jstack, jconsole, jinfo, jmap, jdb, jstat, jps, 下面对这些工具做简单介绍:
 jstack -- 如果java程 ......

JAVA程序员面试之葵花宝典

JAVA程序员面试之葵花宝典
1、面向对象的特征有哪些方面
1.抽象:抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。抽象包括两个方面,一是过程抽象,二是数据抽象。
2.继承:继承是一种联结类的层次模 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号