Class LSBChanger


  • public class LSBChanger
    extends java.lang.Object
    This class can read from and write to the least significant bits of a byte array.
    Author:
    Richard Rudek
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decode​(int length)
      Reads a message from this overlays byte array until length bytes have been read.
      byte[] encode​(byte[] message)
      Takes the byte array message and writes the message into the least significant bits of the byte array carrier using the overlay given in the constructor.
      If the message is null, nothing will change.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • encode

        public byte[] encode​(byte[] message)
                      throws AudioCapacityException
        Takes the byte array message and writes the message into the least significant bits of the byte array carrier using the overlay given in the constructor.
        If the message is null, nothing will change.
        Parameters:
        message - bytes to encode
        Returns:
        the given byte array with the message encoded into the least significant bits
        Throws:
        AudioCapacityException - if the message does not fit into the overlays bytes
      • decode

        public byte[] decode​(int length)
                      throws UnknownStegFormatException
        Reads a message from this overlays byte array until length bytes have been read.
        Parameters:
        length - amount of bytes in the message
        Returns:
        the message as a byte array
        Throws:
        UnknownStegFormatException - if there are not enough bytes to read the message from
        java.lang.IllegalArgumentException - if the length is less than 1