w");. seek (BMP_HEADER_LENGTH); = (raf.length () - messageBitLength - GLOBAL_PREFIX); (tail <0) {new IOException ("Stego container is too small for this message. Available to writing "+
+ ((raf.length () - GLOBAL_PREFIX)/8)
+ "bytes, but expected message length ="
+ message.length ());
} = XOREncoder.encrypt (check, keyBitSet); = XOREncoder.encrypt (length, keyBitSet); = XOREncoder.encrypt (messageBitSet, keyBitSet); = new byte [MSG_CHECK_PREFIX]; = new byte [ MSG_LENGTH_PREFIX]; = new byte [messageBitLength];. read (checkPixels);. read (lengthPixels);. read (messagePixels); (checkPixels, check); (lengthPixels, length); (messagePixels, messageBitSet);. seek (BMP_HEADER_LENGTH );/** /. write (checkPixels);. write (lengthPixels);. write (messagePixels); (raf);
} catch (IOException e) {new IOException (
"Error when process is run in file" + image, e);
} catch (Exception e) {. printStackTrace ();// To change body of catch statement use File | Settings | File Templates.
} finally {(raf! = null) {. close ();
}
}
} static byte [] readFromImage (File image, String key) throws IOException {= null; = BitSet.valueOf (key.getBytes ());; check; length; [] checkPixels; [] lengthPixels; [] messagePixels; {= new RandomAccessFile (image, "rw");. seek (BMP_HEADER_LENGTH); = new byte [MSG_CHECK_PREFIX];. read (checkPixels); = readFromLSB (checkPixels); = XOREncoder.decrypt (check , keyBitSet);. clear (MSG_CHECK_PREFIX, check.size ()); (CHECK_MESSAGE_NUMBER [0]! = check.toLongArray () [0]) {new IOException ("Message is not stegocontainer");
} = new byte [MSG_LENGTH_PREFIX];. read (lengthPixels); = readFromLSB (lengthPixels); = XOREncoder.decrypt (length, keyBitSet);. clear (MSG_LENGTH_PREFIX, length.size ()); = (int) length.toLongArray () [0]; = new byte [messageBitSize];. read (messagePixels); = readFromLSB (messagePixels); = XOREncoder.decrypt (messageBitSet, keyBitSet);. clear (messageBitSize, messageBitSet.length ());. toByteArray ();
} catch (IOException e) {new IOException ("Error when process is run in file"
+ image + " n" + e, e);
} catch (Exception e) {new IOException ("Error when process is run in file"
+ image + " n" + e, e);
} finally {(raf! = null) {. close ();
}
}
} static booleanisFullContainer (File image, String key) throws IOException {= null; = BitSet.valueOf (key.getBytes ()); [] checkPixels; check; {= new RandomAccessFile (image, " ; r ");. seek (BMP_HEADER_LENGTH); = new byte [MSG_CHECK_PREFIX];. read (checkPixels); = readFromLSB (checkPixels); = XOREncoder.d...