Package be.tarsos.dsp.util
Class AudioResourceUtils
java.lang.Object
be.tarsos.dsp.util.AudioResourceUtils
public class AudioResourceUtils
extends java.lang.Object
Some utility functions to handle audio resources.
- Author:
- Joren Six
-
Method Summary
Modifier and Type Method Description static java.lang.String
parseM3U(java.lang.String inputUrl)
Parses the M3U file and returns the first file name.static java.lang.String
parsePLS(java.lang.String inputUrl)
Parses the PLS file and returns the first file name.static java.lang.String
readTextFromUrl(java.net.URL url)
Return the text of the file with the given URL.static java.lang.String
sanitizeResource(java.lang.String inputResource)
Returns a more practical audio resource name.
-
Method Details
-
sanitizeResource
public static java.lang.String sanitizeResource(java.lang.String inputResource)Returns a more practical audio resource name. E.g. if http://stream.com/stream.pls is given, the PLS-file is parsed and the first audio file is returned. It supports PLS, M3U, AXS and XSPF"- Parameters:
inputResource
- The input resource, a file, URL, PLS-file or M3U-file.- Returns:
- A more practical audio resource name.
-
parsePLS
public static java.lang.String parsePLS(java.lang.String inputUrl)Parses the PLS file and returns the first file name.- Parameters:
inputUrl
- The input PLS file.- Returns:
- The first file name in the PLS playlist.
-
parseM3U
public static java.lang.String parseM3U(java.lang.String inputUrl)Parses the M3U file and returns the first file name.- Parameters:
inputUrl
- The input M3U file.- Returns:
- The first file name in the M3U play list.
-
readTextFromUrl
public static java.lang.String readTextFromUrl(java.net.URL url)Return the text of the file with the given URL. E.g. if http://test.be/text.txt is given the contents of text.txt is returned.- Parameters:
url
- The URL.- Returns:
- The contents of the file.
-