Package io.github.mastodonContentMover
Class MediaFile
java.lang.Object
io.github.mastodonContentMover.MediaFile
Holds in an XML-persistable object the metadata associated with a media file attached
to a
Post object.
Because this class uses JAXB and instances of it are held within Post
objects, persistance is managed by the associated Post
object (instances of this class are saved when the Post
object that contains them are saved), so no marshalling or unmarshalling code is needed here.- Since:
- 0.01.00
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringRetrieves the alt text or description of the content in the media file associated with thisMediaFile, corresponding to thedescriptionfield within Mastodon.protected StringRetrieves the path on the local file system for the media file associated with thisMediaFileobject.protected floatRetrieves x coordinate of the focal point for the media file associated with thisMediaFileobject.protected floatRetrieves y coordinate of the focal point for the media file associated with thisMediaFileobject.protected StringRetrieves the Mastodon media type for the media file associated with thisMediaFile, corresponding to thedescriptionfield within Mastodon.protected StringRetrieves the MIME type of the media file associated with thisMediaFileobject, used when reuploading the file to Mastodon to attach to a reposted status.protected StringRetrieves the path on the local file system for the thumbnail for the media file associated with thisMediaFileobject.protected static StringObtain the suffix that should be attached to the name of a media file (without the file extension) when naming a thumbnail for that media file.protected voidsetAltText(String at) Stores the value of the Mastodondescriptionfield, which is an alt text or description, for the media file associated with thisMediaFileobject.protected voidStores the directory where the media file associated with thisMediaFileobject is stored on the local file system.protected voidsetFocalPoint(float x, float y) Stores the x and y coordinates of the focal point for the media file associated with thisMediaFileobject, which allow Mastodon to preview a limited area of an image according to the user's preferences when not all of it is visible in the user interface.
-
Constructor Details
-
MediaFile
- Parameters:
fn- the filename for the media file to be associated with thisMediaFileobject- Since:
- 0.01.00
-
MediaFile
Creates aMediaFileobject with the filename, directory, Mastodon media type, thumbnail filename, alt text (description) and focal point coordinates (x and y) specified.
MIME type is determined based on the extension of the media file, so it can be used when reuploading the file to Mastodon to attach to a reposted status.- Parameters:
fn- the filename for the media file to be associated with thisMediaFileobjectd- the directory where the media file is stored within the local file systemtfn- the filename of a thumbnail for the media filemm- the Mastodon media typeat- the alt text or description of the content in this media filex- the x coordinate for the focal point for this media filey- the y coordinate for the focal point for this media file- Since:
- 0.01.00
- See Also:
-
-
Method Details
-
setDirectory
Stores the directory where the media file associated with thisMediaFileobject is stored on the local file system.- Parameters:
d- the directory where the media file is stored- Since:
- 0.01.00
-
getFilepath
Retrieves the path on the local file system for the media file associated with thisMediaFileobject.- Returns:
- the path on the local file system for the media file
- Since:
- 0.01.00
-
getThumbnailFilepath
Retrieves the path on the local file system for the thumbnail for the media file associated with thisMediaFileobject.- Returns:
- the path on the local file system for the thumbnail file
- Since:
- 0.01.00
-
getThumbnailFileSuffix
Obtain the suffix that should be attached to the name of a media file (without the file extension) when naming a thumbnail for that media file.- Returns:
- the suffix
- Since:
- 0.01.00
-
getMimeType
Retrieves the MIME type of the media file associated with thisMediaFileobject, used when reuploading the file to Mastodon to attach to a reposted status.- Returns:
- the MIME type of the media file
- Since:
- 0.01.00
-
getMastodonMediaType
Retrieves the Mastodon media type for the media file associated with thisMediaFile, corresponding to thedescriptionfield within Mastodon. object.- Returns:
- the Mastodon media type for the media file
- Since:
- 0.01.00
- See Also:
-
setAltText
Stores the value of the Mastodondescriptionfield, which is an alt text or description, for the media file associated with thisMediaFileobject.- Parameters:
at- the alt text or description of the content in the media file- Since:
- 0.01.00
- See Also:
-
getAltText
Retrieves the alt text or description of the content in the media file associated with thisMediaFile, corresponding to thedescriptionfield within Mastodon. object.- Returns:
- the alt text or description of the content in the media file
- Since:
- 0.01.00
- See Also:
-
setFocalPoint
protected void setFocalPoint(float x, float y) Stores the x and y coordinates of the focal point for the media file associated with thisMediaFileobject, which allow Mastodon to preview a limited area of an image according to the user's preferences when not all of it is visible in the user interface.- Parameters:
x- the x coordinate for the focal point for this media filey- the y coordinate for the focal point for this media file- Since:
- 0.01.00
- See Also:
-
getFocalPointX
protected float getFocalPointX()- Returns:
- the x coordinate for the focal point for this media file
- Since:
- 0.01.00
- See Also:
-
getFocalPointY
protected float getFocalPointY()- Returns:
- the y coordinate for the focal point for this media file
- Since:
- 0.01.00
- See Also:
-