Java URI Create getURIs(final Object[] objs)

Here you can find the source of getURIs(final Object[] objs)

Description

ottengo un array di URI da un array contenente File o URL

License

Open Source License

Parameter

Parameter Description
objs - array contenente oggetti di tipo File, URL o URI

Declaration

public static URI[] getURIs(final Object[] objs) throws URISyntaxException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import java.util.LinkedList;
import java.util.List;

public class Main {
    /**//from   www  .j  ava  2s  .c  o m
     * ottengo un array di URI da un array contenente File o URL
     * @param objs - array contenente oggetti di tipo File, URL o URI
     */
    public static URI[] getURIs(final Object[] objs) throws URISyntaxException {
        final List<URI> uris = new LinkedList<URI>();
        for (final Object obj : objs) {
            if (obj instanceof URI) {
                uris.add((URI) obj);
            } else if (obj instanceof URL) {
                uris.add(((URL) obj).toURI());
            } else if (obj instanceof File) {
                uris.add(((File) obj).toURI());
            } else {
                continue;
            }
        }
        return uris.toArray(new URI[uris.size()]);
    }
}

Related

  1. getURIFromPath(String fileOrURI)
  2. getURIFromPath(String path)
  3. getURIName(String forwardSlashPath)
  4. getURIName(URI uri)
  5. getURIParameterValue(URI uri, String name, String defVal)
  6. getUriScheme(String address)
  7. getURIsPrettyPrint(final Collection uris)
  8. getURIStream(Object obj)
  9. getURIWithAuthority(URI uri, String authority)