プロジェクトにビデオステガノグラフィーを実装しています。ここからアルゴリズムに出くわしました。私はコードを試してテストしましたが、埋め込み部分は正常に機能しています。しかし、クラスreadByte
の最後のメソッドである で問題が発生しました。VideoSteganography
メソッドは を与えArrayIndexOutOfBoundsException
ます。以下、方法です。
パラメータを次のように渡します
String fname = jTextField3.getText();
File fil = new File(fname);
String password = "123456";
SteganoInformation cls = new SteganoInformation(fil);
VideoSteganography.retrieveFile(cls, password, true);
そして方法は
public static boolean retrieveFile(SteganoInformation info, String password, boolean overwrite)
{
File dataFile= null;
features= info.getFeatures();
try
{
masterFile= info.getFile();
byteArrayIn= new byte[(int) masterFile.length()];
DataInputStream in= new DataInputStream(new FileInputStream(masterFile));
in.read(byteArrayIn, 0, (int)masterFile.length());
in.close();
messageSize= info.getDataLength();
byte[] fileArray= new byte[messageSize];
inputOutputMarker= info.getInputMarker();
readBytes(fileArray);
.......
}
上記のメソッド readBytes に注意してください。例外がスローされ、以下のように記述されています。
private static void readBytes(byte[] bytes)
{
int size= bytes.length;
for(int i=0; i<size ; i++)
{
bytes[i]= byteArrayIn[inputOutputMarker];
inputOutputMarker++;
}
}