GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
URIDumpUtil.java
Go to the documentation of this file.
1package com.jogamp.common.net;
2
3import java.net.MalformedURLException;
4import java.net.URI;
5import java.net.URISyntaxException;
6import java.net.URL;
7
8public class URIDumpUtil {
9 public static void showURX(final String urx) throws MalformedURLException, URISyntaxException {
10 System.err.println("WWWWWW "+urx);
11 showURL(new URL(urx));
12 showURI(new URI(urx));
13 System.err.println("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
14 }
15
16 public static void showURL(final URL url) {
17 System.err.println("XXXXXX URL "+url.toString());
18 System.err.println("protocol: "+url.getProtocol());
19 System.err.println("auth: "+url.getAuthority());
20 System.err.println("host: "+url.getHost());
21 System.err.println("port: "+url.getPort() + " ( " + url.getDefaultPort() + " ) " );
22 System.err.println("file: "+url.getFile() + " ( path " + url.getPath() + ", query " + url.getQuery() + " ) " );
23 System.err.println("ref: "+url.getRef());
24 }
25
26 public static void showURI(final URI uri) {
27 showURI("YYYYYY URI "+uri+", isOpaque "+uri.isOpaque()+", isAbs "+uri.isAbsolute(), uri);
28 }
29 public static void showURI(final String message, final URI uri) {
30 System.err.println(message);
31
32 System.err.println("0.0.0 string: "+uri.toString());
33 System.err.println("0.0.0 ascii : "+uri.toASCIIString());
34
35 System.err.println("1.0.0 scheme: "+uri.getScheme());
36 System.err.println("2.0.0 scheme-part: "+uri.getRawSchemeSpecificPart()+" (raw), "+uri.getSchemeSpecificPart()+" (dec)");
37 System.err.println("2.1.0 auth: "+uri.getRawAuthority()+" (raw), "+uri.getAuthority()+" (dec)");
38 System.err.println("2.1.1 user-info: "+uri.getRawUserInfo()+" (raw), "+uri.getUserInfo()+" (dec)");
39 System.err.println("2.1.1 host: "+uri.getHost());
40 System.err.println("2.1.1 port: "+uri.getPort());
41 System.err.println("2.2.0 path: "+uri.getRawPath()+" (raw), "+uri.getPath()+" (dec)");
42 System.err.println("2.3.0 query: "+uri.getRawQuery()+" (raw), "+uri.getQuery()+" (dec)");
43 System.err.println("3.0.0 fragment: "+uri.getRawFragment()+" (raw), "+uri.getFragment()+" (dec)");
44 }
45
46 public static void showUri(final Uri uri) throws URISyntaxException {
47 showUri("ZZZZZZ Uri "+uri+", isOpaque "+uri.opaque+", isAbs "+uri.absolute+", hasAuth "+uri.hasAuthority, uri);
48 }
49
50 public static void showUri(final String message, final Uri uri) throws URISyntaxException {
51 System.err.println(message);
52
53 System.err.println("0.0.0 string: "+uri.toString());
54 System.err.println("0.0.0 ascii : "+uri.toASCIIString());
55 System.err.println("0.0.0 native-file: "+uri.toFile());
56 System.err.println("0.0.0 contained: "+uri.getContainedUri());
57
58 System.err.println("1.0.0 scheme: "+uri.scheme);
59 System.err.println("2.0.0 scheme-part: "+uri.schemeSpecificPart+" (raw), "+Uri.decode(uri.schemeSpecificPart)+" (dec)");
60 System.err.println("2.1.0 auth: "+uri.authority+" (raw), "+Uri.decode(uri.authority)+" (dec)");
61 System.err.println("2.1.1 user-info: "+uri.userInfo+" (raw), "+Uri.decode(uri.userInfo)+" (dec)");
62 System.err.println("2.1.1 host: "+uri.host);
63 System.err.println("2.1.1 port: "+uri.port);
64 System.err.println("2.2.0 path: "+uri.path+" (raw), "+Uri.decode(uri.path)+" (dec)");
65 System.err.println("2.3.0 query: "+uri.query+" (raw), "+Uri.decode(uri.query)+" (dec)");
66 System.err.println("3.0.0 fragment: "+uri.fragment+" (raw), "+Uri.decode(uri.fragment)+" (dec)");
67 }
68
69 /**
70 * Just showing different encoding of Uri -> URI
71 *
72 * @param uri
73 * @throws URISyntaxException
74 */
75 public static void showReencodedURIOfUri(final Uri uri) throws URISyntaxException {
76 final URI recomposedURI = uri.toURIReencoded();
77 showURI("YYYYYY Recomposed URI "+recomposedURI+", isOpaque "+recomposedURI.isOpaque()+", isAbs "+recomposedURI.isAbsolute(), recomposedURI);
78 final String recomposedURIStr = recomposedURI.toString();
79 final boolean equalsRecompURI = uri.input.equals(recomposedURIStr);
80 System.err.println("source Uri: "+uri.input);
81 System.err.println("recomp URI: "+recomposedURIStr+" - "+(equalsRecompURI?"EQUAL":"UNEQUAL"));
82 }
83
84 /**
85 * Just showing different encoding of URI -> Uri
86 *
87 * @param uri
88 * @throws URISyntaxException
89 */
90 public static void showReencodedUriOfURI(final URI uri) throws URISyntaxException {
91 final Uri recomposedUri = Uri.valueOf(uri);
92 showUri("ZZZZZZ Recomposed Uri "+recomposedUri+", isOpaque "+recomposedUri.opaque+", isAbs "+recomposedUri.absolute+", hasAuth "+recomposedUri.hasAuthority, recomposedUri);
93 final String recomposedUriStr = recomposedUri.toString();
94 final boolean equalsRecompUri = uri.toString().equals(recomposedUriStr);
95 System.err.println("source URI: "+uri.toString());
96 System.err.println("recomp Uri: "+recomposedUriStr+" - "+(equalsRecompUri?"EQUAL":"UNEQUAL"));
97 }
98}
static void showReencodedUriOfURI(final URI uri)
Just showing different encoding of URI -> Uri.
static void showURI(final String message, final URI uri)
static void showURI(final URI uri)
static void showUri(final String message, final Uri uri)
static void showURX(final String urx)
Definition: URIDumpUtil.java:9
static void showUri(final Uri uri)
static void showReencodedURIOfUri(final Uri uri)
Just showing different encoding of Uri -> URI.
static void showURL(final URL url)
This class implements an immutable Uri as defined by RFC 2396.
Definition: Uri.java:160
static Uri valueOf(final File file)
Creates a new Uri instance using the given File instance.
Definition: Uri.java:1121
final boolean hasAuthority
Indicating whether authority part is defined or not.
Definition: Uri.java:1214
final boolean opaque
Indicating whether this Uri is opaque, i.e.
Definition: Uri.java:1240
final String toString()
Returns the encoded input as String, never null, same as getEncoded().
Definition: Uri.java:1301
final boolean absolute
Indicating whether this Uri is absolute, i.e.
Definition: Uri.java:1231
static String decode(final Encoded encoded)
Safe Encoded#decode() call on optional encoded instance.
Definition: Uri.java:572