jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
UriTk.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2022 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24package org.jau.io;
25
26import java.util.List;
27
28/**
29 * Limited URI toolkit to query handled protocols by the IO implementation.
30 *
31 * The URI scheme functionality exposed here is limited and only provided to decide whether the used implementation
32 * is able to handle the protocol. This is not a replacement for a proper URI class.
33 */
34public class UriTk {
35 /**
36 * Returns a list of supported protocol supported by [*libcurl* network protocols](https://curl.se/docs/url-syntax.html),
37 * queried at runtime.
38 * @see protocol_supported()
39 */
40 public static native List<String> supported_protocols();
41
42 /**
43 * Returns the valid uri-scheme from given uri,
44 * which is empty if no valid scheme is included.
45 *
46 * The given uri must included at least a colon after the uri-scheme part.
47 *
48 * @param uri an uri
49 * @return valid uri-scheme, empty if non found
50 */
51 public static native String get_scheme(final String uri);
52
53 /**
54 * Returns true if the uri-scheme of given uri matches a supported by [*libcurl* network protocols](https://curl.se/docs/url-syntax.html) otherwise false.
55 *
56 * The uri-scheme is retrieved via get_scheme() passing given uri, hence must included at least a colon after the uri-scheme part.
57 *
58 * The *libcurl* supported protocols is queried at runtime, see supported_protocols().
59 *
60 * @param uri an uri to test
61 * @return true if the uri-scheme of given uri is supported, otherwise false.
62 * @see supported_protocols()
63 * @see get_scheme()
64 */
65 public static native boolean protocol_supported(final String uri);
66
67 /**
68 * Returns true if the uri-scheme of given uri matches the local `file` protocol, i.e. starts with `file://`.
69 * @param uri an uri to test
70 */
71 public static native boolean is_local_file_protocol(final String uri);
72}
Limited URI toolkit to query handled protocols by the IO implementation.
Definition UriTk.java:34
static native String get_scheme(final String uri)
Returns the valid uri-scheme from given uri, which is empty if no valid scheme is included.
static native boolean is_local_file_protocol(final String uri)
Returns true if the uri-scheme of given uri matches the local file protocol, i.e.
static native List< String > supported_protocols()
Returns a list of supported protocol supported by libcurl network protocols, queried at runtime.
static native boolean protocol_supported(final String uri)
Returns true if the uri-scheme of given uri matches a supported by libcurl network protocols otherwis...