Package socialmediasteganography
Class SocialMediaSteganographyImpl
- java.lang.Object
-
- socialmediasteganography.SocialMediaSteganographyImpl
-
- All Implemented Interfaces:
SocialMediaSteganography
public class SocialMediaSteganographyImpl extends java.lang.Object implements SocialMediaSteganography
-
-
Constructor Summary
Constructors Constructor Description SocialMediaSteganographyImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decodeCarrier(MediaType mediaType, byte[] carrier)
Decodes hidden payload from carrierboolean
encodeAndPost(APINames apiNames, java.lang.String keyword, byte[] carrier, byte[] payload, MediaType mediaType)
Encodes payload in carrier and posts the result to socialMediaboolean
encodeAndPost(APINames apiNames, java.lang.String keyword, byte[] carrier, byte[] payload, MediaType mediaType, Token token)
Loads carrier from file path and uses encodeAndPostboolean
encodeAndPost(APINames apiNames, java.lang.String keyword, java.lang.String path, byte[] payload, MediaType mediaType)
Loads carrier from file path and uses encodeAndPostbyte[]
encodeCarrier(byte[] carrier, byte[] payload, MediaType mediaType)
Encodes payload into carrier for a given mediatypebyte[][]
getMediaAndDecode(java.lang.String keyword, APINames apiNames, MediaType mediaType)
Gets Media for a certain Keyword and checks if it is a steganographic picture.boolean
postToSocialMedia(byte[] carrier, APINames apiNames, java.lang.String keyword, MediaType mediaType)
Post media to Social Media, if no Token is given set Parameter beforehand e.g.boolean
postToSocialMedia(byte[] carrier, APINames apiNames, java.lang.String keyword, MediaType mediaType, Token token)
Post media to Social Mediavoid
saveEncodedPicture(byte[] carrier, byte[] payload, MediaType mediaType, java.lang.String savepath)
Save encoded Media to given path as a filevoid
saveEncodePicture(java.lang.String filepath, MediaType mediaType, byte[] payload, java.lang.String savepath)
Load Media from a file and save encoded Media to given path as a filevoid
setSeed(java.lang.Long seed)
Set the seed for decoding or encodingSocialMedia
subscribeToSocialMedia(java.lang.String keyword, APINames apiNames)
Subscribes a keyword to a social media
-
-
-
Method Detail
-
encodeAndPost
public boolean encodeAndPost(APINames apiNames, java.lang.String keyword, byte[] carrier, byte[] payload, MediaType mediaType, Token token) throws UnsupportedMediaTypeException, MediaNotFoundException, MediaCapacityException, MediaReassemblingException, java.io.IOException
Description copied from interface:SocialMediaSteganography
Loads carrier from file path and uses encodeAndPost- Specified by:
encodeAndPost
in interfaceSocialMediaSteganography
- Parameters:
apiNames
- API Namekeyword
- The name under which the carrier is posted to social Mediacarrier
- data used to encode the payload inpayload
- payload to encodemediaType
- The type of the carrier (e.g. PNG.GIF)token
- Token class with tokens for Social Media- Returns:
- boolean true, when carrier is successfully posted
- Throws:
UnsupportedMediaTypeException
- if the MediaType is not supportedMediaNotFoundException
- if f the intended media (e.g. Image, Video, ...) could not be read from dataMediaCapacityException
- if the payload doesn't fit in the carrierMediaReassemblingException
- if a problem occurred during writing of the result mediajava.io.IOException
- if there is a problem with reading Data from carrier or payload- See Also:
SocialMediaSteganography.encodeAndPost(APINames, String, byte[], byte[], MediaType)
-
encodeAndPost
public boolean encodeAndPost(APINames apiNames, java.lang.String keyword, byte[] carrier, byte[] payload, MediaType mediaType) throws UnsupportedMediaTypeException, MediaNotFoundException, MediaCapacityException, MediaReassemblingException, java.io.IOException
Description copied from interface:SocialMediaSteganography
Encodes payload in carrier and posts the result to socialMedia- Specified by:
encodeAndPost
in interfaceSocialMediaSteganography
- Parameters:
apiNames
- API Namekeyword
- The name under which the carrier is posted to social Mediacarrier
- data used to encode the payload inpayload
- payload to encodemediaType
- The type of the carrier (e.g. PNG.GIF)- Returns:
- boolean true, when carrier is successfully posted
- Throws:
UnsupportedMediaTypeException
- if the MediaType is not supportedMediaNotFoundException
- if f the intended media (e.g. Image, Video, ...) could not be read from dataMediaCapacityException
- if the payload doesn't fit in the carrierMediaReassemblingException
- if a problem occurred during writing of the result mediajava.io.IOException
- if there is a problem with reading Data from carrier or payload
-
encodeAndPost
public boolean encodeAndPost(APINames apiNames, java.lang.String keyword, java.lang.String path, byte[] payload, MediaType mediaType) throws java.io.IOException, UnsupportedMediaTypeException, MediaNotFoundException, MediaReassemblingException, MediaCapacityException
Description copied from interface:SocialMediaSteganography
Loads carrier from file path and uses encodeAndPost- Specified by:
encodeAndPost
in interfaceSocialMediaSteganography
- Parameters:
apiNames
- API Namekeyword
- The name under which the carrier is posted to social Mediapath
- Path to a Media filepayload
- payload to encodemediaType
- The type of the carrier (e.g. PNG.GIF)- Returns:
- boolean true, when carrier is successfully posted
- Throws:
java.io.IOException
- if there is a problem with reading Data from carrier or payloadUnsupportedMediaTypeException
- if the MediaType is not supportedMediaNotFoundException
- if f the intended media (e.g. Image, Video, ...) could not be read from dataMediaReassemblingException
- if a problem occurred during writing of the result mediaMediaCapacityException
- if the payload doesn't fit in the carrier- See Also:
SocialMediaSteganography.encodeAndPost(APINames, String, byte[], byte[], MediaType)
-
saveEncodedPicture
public void saveEncodedPicture(byte[] carrier, byte[] payload, MediaType mediaType, java.lang.String savepath) throws UnsupportedMediaTypeException, MediaNotFoundException, MediaCapacityException, MediaReassemblingException, java.io.IOException
Description copied from interface:SocialMediaSteganography
Save encoded Media to given path as a file- Specified by:
saveEncodedPicture
in interfaceSocialMediaSteganography
- Parameters:
carrier
- data used to encode the payload inpayload
- payload to encodemediaType
- The type of the carrier (e.g. PNG.GIF)savepath
- The path to which the generated file is saved- Throws:
UnsupportedMediaTypeException
- if the MediaType is not supportedMediaNotFoundException
- if f the intended media (e.g. Image, Video, ...) could not be read from dataMediaCapacityException
- if the payload doesn't fit in the carrierMediaReassemblingException
- if a problem occurred during writing of the result mediajava.io.IOException
- if there is a problem with reading Data from carrier or payload
-
saveEncodePicture
public void saveEncodePicture(java.lang.String filepath, MediaType mediaType, byte[] payload, java.lang.String savepath) throws java.io.IOException, UnsupportedMediaTypeException, MediaNotFoundException, MediaReassemblingException, MediaCapacityException
Description copied from interface:SocialMediaSteganography
Load Media from a file and save encoded Media to given path as a file- Specified by:
saveEncodePicture
in interfaceSocialMediaSteganography
- Parameters:
filepath
- the path to the file thath needs to be encodedmediaType
- The type of the carrier (e.g. PNG.GIF)payload
- payload to encodesavepath
- The path to which the generated file is saved- Throws:
java.io.IOException
- if there is a problem with reading Data from carrier or payloadUnsupportedMediaTypeException
- if the MediaType is not supportedMediaNotFoundException
- if f the intended media (e.g. Image, Video, ...) could not be read from dataMediaReassemblingException
- if a problem occurred during writing of the result mediaMediaCapacityException
- if the payload doesn't fit in the carrier- See Also:
SocialMediaSteganography.saveEncodedPicture(byte[], byte[], MediaType, String)
-
postToSocialMedia
public boolean postToSocialMedia(byte[] carrier, APINames apiNames, java.lang.String keyword, MediaType mediaType)
Description copied from interface:SocialMediaSteganography
Post media to Social Media, if no Token is given set Parameter beforehand e.g. Tumbler.setApiKey = "..." and Tumbler.setApiSecretKey- Specified by:
postToSocialMedia
in interfaceSocialMediaSteganography
- Parameters:
carrier
- data that should be uploadedapiNames
- API Namekeyword
- The name under which the carrier is posted to social MediamediaType
- The type of the carrier (e.g. PNG.GIF)- Returns:
- boolean true when carrier was successfully posted
-
postToSocialMedia
public boolean postToSocialMedia(byte[] carrier, APINames apiNames, java.lang.String keyword, MediaType mediaType, Token token)
Description copied from interface:SocialMediaSteganography
Post media to Social Media- Specified by:
postToSocialMedia
in interfaceSocialMediaSteganography
- Parameters:
carrier
- data that should be uploadedapiNames
- API Namekeyword
- The name under which the carrier is posted to social MediamediaType
- The type of the carrier (e.g. PNG.GIF)token
- The token used to access Social Media- Returns:
- boolean true when carrier was successfully posted
-
encodeCarrier
public byte[] encodeCarrier(byte[] carrier, byte[] payload, MediaType mediaType) throws UnsupportedMediaTypeException, MediaCapacityException, MediaNotFoundException, MediaReassemblingException, java.io.IOException
Description copied from interface:SocialMediaSteganography
Encodes payload into carrier for a given mediatype- Specified by:
encodeCarrier
in interfaceSocialMediaSteganography
- Parameters:
carrier
- data used to encode the payload inpayload
- payload to encodemediaType
- The type of the carrier (e.g. PNG.GIF)- Returns:
- byte[] carrier with encoded payload
- Throws:
UnsupportedMediaTypeException
- if the MediaType is not supportedMediaCapacityException
- if the payload doesn't fit in the carrierMediaNotFoundException
- if f the intended media (e.g. Image, Video, ...) could not be read from dataMediaReassemblingException
- if a problem occurred during writing of the result mediajava.io.IOException
- if there is a problem with reading Data from carrier or payload
-
subscribeToSocialMedia
public SocialMedia subscribeToSocialMedia(java.lang.String keyword, APINames apiNames)
Description copied from interface:SocialMediaSteganography
Subscribes a keyword to a social media- Specified by:
subscribeToSocialMedia
in interfaceSocialMediaSteganography
- Parameters:
keyword
- The name under which the carrier is posted to social MediaapiNames
- API Name- Returns:
- Social Media The Social Media Class that can be used for interacting with given API
-
getMediaAndDecode
public byte[][] getMediaAndDecode(java.lang.String keyword, APINames apiNames, MediaType mediaType)
Description copied from interface:SocialMediaSteganography
Gets Media for a certain Keyword and checks if it is a steganographic picture. If it is, proceeds to decode the picture and return payload- Specified by:
getMediaAndDecode
in interfaceSocialMediaSteganography
- Parameters:
keyword
- keyword under which the media was postedapiNames
- name of the api usedmediaType
- media type in which the payload is decoded- Returns:
- payloads all payloads that could be read
-
decodeCarrier
public byte[] decodeCarrier(MediaType mediaType, byte[] carrier) throws UnsupportedMediaTypeException, UnknownStegFormatException, MediaNotFoundException, java.io.IOException
Description copied from interface:SocialMediaSteganography
Decodes hidden payload from carrier- Specified by:
decodeCarrier
in interfaceSocialMediaSteganography
- Parameters:
mediaType
- The type of the carrier (e.g. PNG.GIF)carrier
- data with encoded payload- Returns:
- payload decoded payload
- Throws:
UnsupportedMediaTypeException
- if the MediaType is not supportedUnknownStegFormatException
- UnknownStegFormatExceptionMediaNotFoundException
- if the intended media (e.g. Image, Video, ...) could not be read from steganographicDatajava.io.IOException
- if a problem occurs during reading of steganographicData
-
setSeed
public void setSeed(java.lang.Long seed)
Description copied from interface:SocialMediaSteganography
Set the seed for decoding or encoding- Specified by:
setSeed
in interfaceSocialMediaSteganography
- Parameters:
seed
- The seed to initialize random function
-
-