Java URI from toURIArray(String[] array)

Here you can find the source of toURIArray(String[] array)

Description

Convert an array of strings into an array of URI instances.

License

Apache License

Parameter

Parameter Description
array An array of strings - must not be null

Return

An array of URI instances

Declaration

public static URI[] toURIArray(String[] array) 

Method Source Code

//package com.java2s;
/*/*ww w.j av a2  s.c o m*/
 * Copyright 2004,2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.net.URI;

public class Main {
    /**
     * Convert an array of strings into an array of URI instances. The string
     * values should be in a format which can be reliably converted into the URI
     * type using the URI.create() method.
     *
     * @param array An array of strings - must not be null
     * @return An array of URI instances
     */
    public static URI[] toURIArray(String[] array) {
        URI[] uris = new URI[array.length];
        for (int i = 0; i < array.length; i++) {
            uris[i] = URI.create(array[i].trim());
        }
        return uris;
    }
}

Related

  1. toURI(String sUri)
  2. toURI(String uri)
  3. toURI(String uri)
  4. toUri(String uri)
  5. toURI(URI parent, String child)
  6. toURIList(Collection stringList)
  7. toURIObject(String uri)
  8. toURIs(File... files)
  9. toURIs(Iterable files)