Here you can find the source of getURIStream(Object obj)
public static InputStream getURIStream(Object obj) throws IOException
//package com.java2s; /************************************************************************* * Copyright (c) 2012 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/* w w w.j ava2 s .c o m*/ * Actuate Corporation - added support of relative file path * Actuate Corporation - support defining an Excel input file path or URI as part of the data source definition ************************************************************************* */ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; public class Main { public static InputStream getURIStream(Object obj) throws IOException { if (obj instanceof File) { return new BufferedInputStream(new FileInputStream((File) obj)); } else if (obj instanceof URI) { return ((URI) obj).toURL().openStream(); } return null; } }