java.lang.Object
one.jpro.platform.media.util.MediaUtil
Media utility class.
- Author:
- Besmir Beqiri
-
Method Summary
Modifier and TypeMethodDescriptiongetExtension(String fileName) Get the file extension.static Optional<MediaSource> retrieve(javafx.stage.Stage stage, MediaSource mediaSource, String fileName) Retrieve the media file from the given media source.
-
Method Details
-
retrieve
public static Optional<MediaSource> retrieve(javafx.stage.Stage stage, MediaSource mediaSource, String fileName) throws IOException Retrieve the media file from the given media source.- Parameters:
stage- application primary stagemediaSource- the media sourcefileName- the file name without extension- Returns:
- an optional
MediaSourceobject referring the new resource if the application runs on a desktop/device. When the application runs on the web (via JPro), it returns the same media source as the one provided as an input parameter. Otherwise, if an error occurs,nullis returned. is returned - Throws:
IOException- if an I/O error occurs
-
getExtension
Get the file extension.- Parameters:
fileName- the file name- Returns:
- a string containing the file extension
-