Initial commit

This commit is contained in:
Tinglyyy
2026-01-18 14:40:25 +01:00
commit 1637078249
13 changed files with 262 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
/* Author: Maple
* Jan. 18 2026
* */
package org.openautonomousconnection.infonamelib;
import org.openautonomousconnection.infonamelib.protocols.ftp.FTPInfoNameURLStreamHandler;
import org.openautonomousconnection.infonamelib.protocols.web.WebInfoNameURLStreamHandler;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
public class InfoNameURLStreamHandlerFactory implements URLStreamHandlerFactory {
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
return switch (protocol) {
case "web" -> new WebInfoNameURLStreamHandler();
case "ftp" -> new FTPInfoNameURLStreamHandler();
default -> null;
};
}
}

View File

@@ -0,0 +1,16 @@
/* Author: Maple
* Jan. 18 2026
* */
package org.openautonomousconnection.infonamelib;
import java.net.URL;
public class InfoNames {
/**
* Switches accepted Schemes in URLs to InfoName ones
*/
public static void registerOACInfoNameProtocols() {
URL.setURLStreamHandlerFactory(new InfoNameURLStreamHandlerFactory());
}
}

View File

@@ -0,0 +1,26 @@
/* Author: Maple
* Jan. 18 2026
* */
package org.openautonomousconnection.infonamelib.protocols.ftp;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
public class FTPInfoNameURLConnection extends URLConnection {
/**
* Constructs a URL connection to the specified URL. A connection to
* the object referenced by the URL is not created.
*
* @param url the specified URL.
*/
protected FTPInfoNameURLConnection(URL url) {
super(url);
}
@Override
public void connect() throws IOException {
}
}

View File

@@ -0,0 +1,17 @@
/* Author: Maple
* Jan. 18 2026
* */
package org.openautonomousconnection.infonamelib.protocols.ftp;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
public class FTPInfoNameURLStreamHandler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL url) throws IOException {
return new FTPInfoNameURLConnection(url);
}
}

View File

@@ -0,0 +1,26 @@
/* Author: Maple
* Jan. 18 2026
* */
package org.openautonomousconnection.infonamelib.protocols.web;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
public class WebInfoNameURLConnection extends URLConnection {
/**
* Constructs a URL connection to the specified URL. A connection to
* the object referenced by the URL is not created.
*
* @param url the specified URL.
*/
protected WebInfoNameURLConnection(URL url) {
super(url);
}
@Override
public void connect() throws IOException {
}
}

View File

@@ -0,0 +1,17 @@
/* Author: Maple
* Jan. 18 2026
* */
package org.openautonomousconnection.infonamelib.protocols.web;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
public class WebInfoNameURLStreamHandler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL url) throws IOException {
return new WebInfoNameURLConnection(url);
}
}