public byte[] embedData(byte[] msg,String msgFileName,byte[] cover,String coverFileName,String stegoFileName) throws OpenStegoException {
  BufferedImage image=null;
  DctLSBOutputStream os=null;
  int imgType=0;
  try {
    if (cover == null) {
      image=ImageUtil.generateRandomImage((DCTDataHeader.getMaxHeaderSize() + msg.length) * 8 * DCT.NJPEG* DCT.NJPEG);
    }
 else {
      image=ImageUtil.byteArrayToImage(cover,coverFileName);
    }
    imgType=image.getType();
    os=new DctLSBOutputStream(image,msg.length,msgFileName,this.config);
    os.write(msg);
    os.close();
    return ImageUtil.imageToByteArray(os.getImage(imgType),stegoFileName,this);
  }
 catch (  IOException ioEx) {
    throw new OpenStegoException(ioEx);
  }
}

public byte [ ] embedData ( byte [ ] msg , String msgFileName , byte [ ] cover , String coverFileName , String stegoFileName ) throws OpenStegoException { BufferedImage image = null ; DctLSBOutputStream os = null ; int imgType = 0 ; try { if ( cover == null ) { image = ImageUtil . generateRandomImage ( ( DCTDataHeader . getMaxHeaderSize ( ) + msg . length ) * 8 * DCT . NJPEG * DCT . NJPEG ) ; } else { image = ImageUtil . byteArrayToImage ( cover , coverFileName ) ; } imgType = image . getType ( ) ; os = new DctLSBOutputStream ( image , msg . length , msgFileName , this . config ) ; os . write ( msg ) ; os . close ( ) ; return ImageUtil . imageToByteArray ( os . getImage ( imgType ) , stegoFileName , this ) ; } catch ( IOException ioEx ) { throw new OpenStegoException ( ioEx ) ; } }
method to embed the message into the cover data
