Accepting both file paths and URL in Java
Is there a method which would accept the following paths and return appropriate URI:

    test.xml // File in CWD
    ./test.xml // The same
    ../test.xml // File in parent directory
    /etc/test.xml // Absolute path
    file:///etc/test.xml // Full URL
    http://example.com/test.xml // URL for http

Currently all I can think of is parse as url (URL.create) and if it fails attempt to try to parse it as File/Path.
Accepting both file paths and URL in Java
===

Is there a method which would accept the following paths and return appropriate URI:

    test.xml // File in CWD
    ./test.xml // The same
    ../test.xml // File in parent directory
    /etc/test.xml // Absolute path
    file:///etc/test.xml // Full URL
    http://example.com/test.xml // URL for http

Currently all I can think of is parse as url (URL.create) and if it fails attempt to try to parse it as File/Path.