List of usage examples for java.io FileNotFoundException FileNotFoundException
public FileNotFoundException(String s)
FileNotFoundException
with the specified detail message. From source file:org.dawnsci.commandserver.jython.JythonConsumer.java
@Override public void start() throws Exception { //This starts the interpreter for script submission (Borrowed from org.dawb.passerelle.actors.scripts.PythonScript) //All set? Let's go! interpreter = JythonInterpreterUtils.getFullInterpreter(null, "com.fasterxml.jackson.core", "org.dawnsci.persistence"); //Get shared python functions and pass in as a stream. URL pySOURL = this.getClass().getResource("python_funcs.py"); if (pySOURL == null) { throw new FileNotFoundException("python_funcs.py (resource not found)"); }/*from w ww. ja va 2 s . c om*/ interpreter.execfile(pySOURL.openStream()); System.out.println("Jython interpreter started."); //This after other setup as this just sits and sits and... super.start(); }
From source file:com.clican.pluto.common.resource.ClassPathResource.java
public InputStream getInputStream() throws FileNotFoundException { try {/*from w w w. jav a2 s . co m*/ InputStream is = resource.openStream(); return is; } catch (Exception e) { throw new FileNotFoundException(e.getMessage()); } }
From source file:fedora.utilities.Log4J.java
/** * Initializes Log4J from an XML file.//from ww w. j av a 2s. c o m * * @param xmlFile the Log4J xml file. * @throws IOException if configuration fails due to problems with the file. */ public static void initFromXMLFile(File xmlFile) throws IOException { if (!xmlFile.exists()) { throw new FileNotFoundException(xmlFile.getPath()); } DOMConfigurator.configure(xmlFile.getPath()); }
From source file:lucee.commons.net.http.httpclient3.ResourcePartSource.java
/** * Constructor of the class/*from ww w. j av a2 s. co m*/ * * @param res the FilePart source File. * * @throws FileNotFoundException if the file does not exist or * cannot be read */ public ResourcePartSource(Resource res) throws FileNotFoundException { this.res = res; if (res != null) { if (!res.isFile()) { throw new FileNotFoundException("File is not a normal file."); } if (!res.isReadable()) { throw new FileNotFoundException("File is not readable."); } this.fileName = res.getName(); } }
From source file:hd3gtv.mydmam.pathindexing.ImporterCDFinder.java
public ImporterCDFinder(File filetoimport, String poolname) throws IOException, ParseException { super();// w w w.j a v a2 s . c om this.filetoimport = filetoimport; if (filetoimport == null) { throw new NullPointerException("\"filetoimport\" can't to be null"); } if (filetoimport.exists() == false) { throw new FileNotFoundException(filetoimport.getPath()); } this.poolname = poolname; }
From source file:com.intel.cosbench.driver.util.HashedFileInputStream.java
public HashedFileInputStream(File file, boolean hashCheck, HashUtil hashutil, long size) throws FileNotFoundException { super(size);/*from w w w . j av a 2s.co m*/ if (!file.canRead()) { throw new FileNotFoundException("can not read from " + file.getName()); } this.util = hashutil; this.fs = new FileInputStream(file); this.hashCheck = hashCheck; this.size = size; this.hashLen = this.util.getHashLen(); }
From source file:com.mycila.testing.plugins.jetty.locator.RegFileLocator.java
/** * {@inheritDoc}// ww w . ja v a2 s.c o m * * @see com.mycila.testing.plugins.jetty.locator.FileLocator#locate(java.lang.String) */ public Iterable<File> locate(final String path) throws FileNotFoundException { final Collection<File> files = listFiles(new File("."), new RegExpFileFilter(path), trueFileFilter()); if (files.size() < 1) { throw new FileNotFoundException( "regexp '" + quoteReplacement(path) + "' matches less than one file : " + files); } else if (files.size() > 1) { //throw new FileNotFoundException("regexp '" + quoteReplacement(path) + "' matches more than one file : " + files); } return files; }
From source file:ja.centre.util.io.Files.java
public static void delete(String fileName) throws FileNotFoundException, IOException { Arguments.assertNotNull("fileName", fileName); // check existance if (!exists(fileName)) { throw new FileNotFoundException("File: \"" + fileName + "\""); }//from ww w .ja va2 s.c o m // delete if (!new File(fileName).delete()) { throw new IOException("File \"" + fileName + "\" could not be deleted due to unknown obstacle "); } }
From source file:com.tc.test.ClassBasedDirectoryTree.java
public File getDirectory(Class<?> theClass) throws IOException { String[] parts = theClass.getName().split("\\."); File destFile = buildFile(this.root, parts, 0); if (destFile.exists() && (!destFile.isDirectory())) throw new FileNotFoundException("'" + destFile + "' exists, but is not a directory."); return destFile; }
From source file:lucee.commons.net.http.httpclient.ResourceBody.java
public ResourceBody(Resource res, String mimetype, String fileName, String charset) throws FileNotFoundException { super(StringUtil.isEmpty(mimetype, true) ? DEFAULT_MIMETYPE : mimetype); this.res = res; if (!res.isFile()) { throw new FileNotFoundException("File is not a normal file."); }//from w w w . j a v a2s. c o m if (!res.isReadable()) { throw new FileNotFoundException("File is not readable."); } this.fileName = StringUtil.isEmpty(fileName, true) ? res.getName() : fileName; this.charset = charset; }