在java中用于视频隐写术的类

在java中用于视频隐写术的类,java,steganography,Java,Steganography,我已经用java实现了图像和音频隐写术,现在我想实现视频隐写术。但是,我仍然无法找到用于执行此操作的类,例如允许我以二进制形式查看视频数据的类(因为我将使用lsb替换技术).我去年毕业的最后一个项目是使用netbeans IDE开发的视频速记。我将在这里发布代码,说明我是如何完成所有过程的 package Stegnography; import java.io.File; /* * To change this template, choose Tools | Templates *

我已经用java实现了图像和音频隐写术,现在我想实现视频隐写术。但是,我仍然无法找到用于执行此操作的类,例如允许我以二进制形式查看视频数据的类(因为我将使用lsb替换技术).

我去年毕业的最后一个项目是使用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**
封装结构图;
导入java.io.File;
/*
*要更改此模板,请选择工具|模板
*然后在编辑器中打开模板。
*/
导入java.io.FileInputStream;
导入java.io.FileOutputStream;
/**
*
*@author DeepRocks
*/
公共类EMB进程{
字符串embfilename;
公共字符串emb(字符串s、字符串s1)
{
试一试{
文件=新文件;
文件file1=新文件(s1);
FileInputStream FileInputStream=新的FileInputStream;
FileOutputStream FileOutputStream=新的FileOutputStream(“temp”);
字节abyte0[]=新字节[8];
int i;
int k;
对于(k=0;(i=fileinputstream.read(abyte0,0,8))>0;k=i)
write(abyte0,0,i);
fileinputstream.close();
对于(int l=1;l 0)
write(abyte0,0,j);
fileinputstream.close();
fileoutputstream.close();
delete();
文件file2=新文件(“temp”);
文件2.重命名为(文件);
embfilename=file.getName();
}
捕获(例外e){
e、 printStackTrace();
embfilename=“”;
}
返回embfilename;
}
公共字符串demb(字符串s)
{
布尔标志;
字符串demfile=“”;
尝试
{
文件=新文件;
字符串输出路径=s.substring(0,s.lastIndexOf(“\\”)+1);
FileInputStream FileInputStream=新的FileInputStream;
字符c='\b';
字节abyte0[]=新字节[c];
字符串s1=“”;
int i;
而((i=fileinputstream.read(abyte0,0,c))>0)
{
s1=新字符串(abyte0);
if(s1.equals(“数据文件”))
打破
}
如果(!s1.equals(“数据文件”))
{
flag=false;
fileinputstream.close();
返回demfile;
}
abyte0=新字节[50];
读取(abyte0,0,50);
s1=新字符串(abyte0);
字符串s2=s1.trim();
字符串fpath=s2.substring(0,s2.lastIndexOf(“.”+1)+“enc”;
System.out.println(“fpath------”+fpath);
FileOutputStream FileOutputStream=新的FileOutputStream(outpath+fpath);
c='\u5000';
abyte0=新字节[c];
而((i=fileinputstream.read(abyte0,0,c))>0)
write(abyte0,0,i);
fileinputstream.close();
fileoutputstream.close();
demfile=fpath;
}
捕获(异常)
{
demfile=“”;
异常。printStackTrace();
System.out.println(例外);
}
返回demfile;
}
}**此代码用于嵌入进程**
请明确你真正想要的是什么,我会帮你的只要看看我的代码如果它对你有帮助,我会给你我的项目