Package steganography.audio
Class LSBChanger
- java.lang.Object
-
- steganography.audio.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
-
-
Constructor Summary
Constructors Constructor Description LSBChanger(AudioOverlay overlay)
-
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.
-
-
-
Constructor Detail
-
LSBChanger
public LSBChanger(AudioOverlay overlay)
-
-
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 fromjava.lang.IllegalArgumentException
- if the length is less than 1
-
-