I am implementing a video steganography for my project. I came across the algorithm from here . i have tried and tested the code and the embedding part is working fine. But i encountered a problem with the readByte
which is the last method in the VideoSteganography
class. The method Gives ArrayIndexOutOfBoundsException
. Below is the method.
I pass the parameters as
String fname = jTextField3.getText();
File fil = new File(fname);
String password = "123456";
SteganoInformation cls = new SteganoInformation(fil);
VideoSteganography.retrieveFile(cls, password, true);
and the method is
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);
.......
}
Notice the method readBytes above, it throws the exception and its written as below
private static void readBytes(byte[] bytes)
{
int size= bytes.length;
for(int i=0; i<size ; i++)
{
bytes[i]= byteArrayIn[inputOutputMarker];
inputOutputMarker++;
}
}