Here you can find the source of openInputStream(String path)
inputStream
to the specified file.
Parameter | Description |
---|---|
path | a <code>string</code> as the name of the file to load |
inputStream
if the file could be found, null
otherwise
public static InputStream openInputStream(String path)
//package com.java2s; /******************************************************************************* * Copyright (c) 2003-2005, 2013 Till Zoppke. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html//from ww w . j a v a 2 s .c om * * Contributors: * Till Zoppke - initial API and implementation ******************************************************************************/ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { /** * Opens an <code>inputStream</code> to the specified file. * * @param path * a <code>string</code> as the name of the file to load * @return an <code>inputStream</code> if the file could be found, <br> * or <code>null</code> otherwise */ public static InputStream openInputStream(String path) { try { return new FileInputStream(path); } catch (IOException e) { return null; } } }