java.lang.Object
uk.co.caprica.vlcj.binding.support.strings.NativeUri

public final class NativeUri extends Object
Functions that deal with URI's that are passed to the native LibVlc library.
  • Method Details

    • encodeUri

      public static String encodeUri(String uri)
      Encode, if needed, a local file MRL that may contain Unicode characters as a file URL with "percent" encoding.

      This method deals with the special case of an MRL for a local file name containing Unicode characters. Such MRLs must be encoded as file URLs, by adding a "file://" prefix before percent-encoding the filename.

      Without this, vlc will not be able to play the file since it is using native API that can not handle unencoded Unicode characters.

      This method does not deal with any MRLs that are URLs since Unicode characters are forbidden by specification for any URL.

      What this means in practical terms is that if an MRL is specified that contains a "scheme" like "http", or "file" then that MRL will not be encoded by this method, even if it contains Unicode characters. This situation if it arises, is considered a client application validation failure.

      Parameters:
      uri - URI
      Returns:
      the original URI if no encoding is required, or a percent-encoded ASCII file URI
    • encodeFileUri

      public static String encodeFileUri(String filename)
      Encode a local file path to a valid URI, properly escaping any Unicode characters wit "percent" encoding.
      Parameters:
      filename - filename to encode as a URI
      Returns:
      URI