Package jsyntaxpane.util
Class JarServiceProvider
java.lang.Object
jsyntaxpane.util.JarServiceProvider
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
findResource
(String url) Attempt to find a location url.static InputStream
findResource
(String url, ClassLoader cl) Attempt to find a location url.getServiceProviders
(Class cls) Return an Object array from the file in META-INF/resources/{classname}Read the given URL and returns a List of Strings for each input line Each line will not have the line terminator.static Properties
readProperties
(Class clazz) Read a file in the META-INF/services location.static Properties
readProperties
(String name) Read a file in the META-INF/services named name appended with ".properties" If no file is found, then a an empty Property instance will be returnedstatic Properties
readProperties
(String name, Locale locale) Read language specific files in the META-INF/services named name appended with ".properties".readStringsMap
(String name) Read a file in the META-INF/services named name appended with ".properties", and returns it as aMapinvalid input: '<'String, String>
If no file is found, then a an empty Property instance will be returned
-
Field Details
-
SERVICES_ROOT
- See Also:
-
-
Method Details
-
getServiceProviders
Return an Object array from the file in META-INF/resources/{classname}- Parameters:
cls
-- Returns:
- Throws:
IOException
-
readProperties
Read a file in the META-INF/services location. File name will be fully qualified classname, in all lower-case, appended with ".properties" If no file is found, then a an empty Property instance will be returned- Parameters:
clazz
-- Returns:
- Property file read.
-
readProperties
Read a file in the META-INF/services named name appended with ".properties" If no file is found, then a an empty Property instance will be returned- Parameters:
name
- name of file (use dots to separate subfolders).- Returns:
- Property file read.
-
readProperties
Read language specific files in the META-INF/services named name appended with ".properties". The contents of the files are merged as follows:- First the default language file (<name>.properties) is read
- Then the general language variant of the file (<name>_<lang>.properties) is read and its entries are added to/overwrite the entries of the default life
- Last the country specific language variant of the file (<name>_<lang>_<country>.properties) is read and its entries are added to/overwrite the existing entries
- config.properties which contains the complete configuration (most likely with English menus, tooltips)
- config_de.properties which only contains menu names and tooltips in German language
- config_de_CH which might just contain entries for specific Swiss spelling variant of some words in a tooltip
-
If no filesis found, then a an empty Property instance will be returned
- Parameters:
name
- name of file (use dots to separate subfolders).locale
- The locale for which to read the files- Returns:
- Property file read.
-
readStringsMap
Read a file in the META-INF/services named name appended with ".properties", and returns it as aMapinvalid input: '<'String, String>
If no file is found, then a an empty Property instance will be returned- Parameters:
name
- name of file (use dots to separate subfolders).- Returns:
- Map of keys and values
-
readLines
Read the given URL and returns a List of Strings for each input line Each line will not have the line terminator. The resource is searched in /META-INF/services/url, then in url, then the url is treated as a location in the current classpath and an attempt to read it from that location is done.- Parameters:
url
- location of file to read- Returns:
- List of Strings for each line read. or EMPTY_LIST if URL is not found
-
findResource
Attempt to find a location url. The following locations are searched in sequence: url, SERVICES_ROOT/url all classpath/url- Parameters:
url
-cl
- classloader- Returns:
- InputSTream at that location, or null if not found
- See Also:
-
findResource
Attempt to find a location url. The following locations are searched in sequence: url, SERVICES_ROOT/url all classpath/url The System ClassLoader is used.- Parameters:
url
-- Returns:
- InputSTream at that location, or null if not found
- See Also:
-