Class MediaUtil

java.lang.Object
one.jpro.platform.media.util.MediaUtil

public final class MediaUtil extends Object
Media utility class.
Author:
Besmir Beqiri
  • 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 stage
      mediaSource - the media source
      fileName - the file name without extension
      Returns:
      an optional MediaSource object 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, null is returned. is returned
      Throws:
      IOException - if an I/O error occurs
    • getExtension

      public static Optional<String> getExtension(String fileName)
      Get the file extension.
      Parameters:
      fileName - the file name
      Returns:
      a string containing the file extension