2013-04-03 62 views
0

我已經在java中實現了圖像和音頻隱寫術,現在我想實現視頻隱寫術。但是,我仍然無法找到曾經這樣做的類,例如那些允許我以二進制形式查看視頻數據的類(因爲我將使用lsb替換技術)。在java中用於視頻隱寫術的類

回答

2

我去年的文憑最終項目是我使用netbeans IDE開發的視頻速記,我將在這裏發佈代碼,我如何完成所有過程來完成它。

package Stegnography; 


import java.io.File; 

/* 
* To change this template, choose Tools | Templates 
* and open the template in the editor. 
*/ 
import java.io.FileInputStream; 
import java.io.FileOutputStream; 

/** 
* 
* @author DeepRocks 
*/ 
public class EmbProcess { 
    String embfilename; 
    public String emb(String s, String s1) 
    { 
     try{ 
     File file = new File(s); 
     File file1 = new File(s1); 
     FileInputStream fileinputstream = new FileInputStream(s); 
     FileOutputStream fileoutputstream = new FileOutputStream("temp"); 
     byte abyte0[] = new byte[8]; 
     int i; 
     int k; 
     for(k = 0; (i = fileinputstream.read(abyte0, 0, 8)) > 0; k = i) 
      fileoutputstream.write(abyte0, 0, i); 

     fileinputstream.close(); 
     for(int l = 1; l <= 8 - k; l++) 
      fileoutputstream.write(65); 

     fileoutputstream.write("DATAFILE".getBytes(), 0, 8); 
     System.out.println("File name==="+file1.getName()); 
     StringBuffer stringbuffer = new StringBuffer(file1.getName()); 
     stringbuffer.setLength(50); 
     fileoutputstream.write(stringbuffer.toString().getBytes(), 0, 50); 
     fileinputstream = new FileInputStream(s1); 
     int j; 
     while((j = fileinputstream.read(abyte0, 0, 8)) > 0) 
      fileoutputstream.write(abyte0, 0, j); 
     fileinputstream.close(); 
     fileoutputstream.close(); 
     file.delete(); 
     File file2 = new File("temp"); 
     file2.renameTo(file); 
     embfilename=file.getName(); 
     } 
     catch(Exception e){ 
      e.printStackTrace(); 
      embfilename=""; 
     } 
     return embfilename; 
    } 

    public String demb(String s) 
    { 
     boolean flag; 
     String demfile = ""; 
     try 
     { 
      File file = new File(s); 
      String outpath=s.substring(0, s.lastIndexOf("\\")+1); 
      FileInputStream fileinputstream = new FileInputStream(s); 
      char c = '\b'; 
      byte abyte0[] = new byte[c]; 
      String s1 = ""; 
      int i; 
      while((i = fileinputstream.read(abyte0, 0, c)) > 0) 
      { 
       s1 = new String(abyte0); 
       if(s1.equals("DATAFILE")) 
        break; 
      } 
      if(!s1.equals("DATAFILE")) 
      { 
       flag=false; 
       fileinputstream.close(); 
       return demfile; 
      } 
      abyte0 = new byte[50]; 
      fileinputstream.read(abyte0, 0, 50); 
      s1 = new String(abyte0); 
      String s2 = s1.trim(); 
      String fpath = s2.substring(0, s2.lastIndexOf(".") + 1) + "enc"; 
      System.out.println("fpath------"+fpath); 
      FileOutputStream fileoutputstream = new FileOutputStream(outpath+fpath); 
      c = '\u5000'; 
      abyte0 = new byte[c]; 
      while((i = fileinputstream.read(abyte0, 0, c)) > 0) 
       fileoutputstream.write(abyte0, 0, i); 
      fileinputstream.close(); 
      fileoutputstream.close(); 
      demfile=fpath; 
     } 
     catch(Exception exception) 
     { 
      demfile=""; 
      exception.printStackTrace(); 
      System.out.println(exception); 
     } 
     return demfile; 
    } 

}**THIS CODE IS FOR EMBEDDING PROCESS** 

請清楚你真正想要什麼,我會幫助你看看我的代碼,如果它幫助你,我會給你我的項目。

+0

你能否提供我的提取碼 –