List of usage examples for java.io FileNotFoundException getMessage
public String getMessage()
From source file:RegexTestHarness.java
private static void initResources() { try {/*w w w . j a va2 s . co m*/ br = new BufferedReader(new FileReader("regex.txt")); } catch (FileNotFoundException fnfe) { System.out.println("Cannot locate input file! " + fnfe.getMessage()); System.exit(0); } try { REGEX = br.readLine(); INPUT = br.readLine(); } catch (IOException ioe) { } pattern = Pattern.compile(REGEX); matcher = pattern.matcher(INPUT); System.out.println("Current REGEX is: " + REGEX); System.out.println("Current INPUT is: " + INPUT); }
From source file:Main.java
private static void CopyFile(String srcPath, String dstPath) { FileChannel srcChannel = null; FileChannel dstChannel = null; try {//from w w w . j a va 2s .c om // Open files srcChannel = (new FileInputStream(srcPath)).getChannel(); dstChannel = (new FileOutputStream(dstPath)).getChannel(); // Transfer the data dstChannel.transferFrom(srcChannel, 0, srcChannel.size()); // Close the files if (srcChannel != null) { srcChannel.close(); } if (dstChannel != null) { dstChannel.close(); } } catch (FileNotFoundException ex) { Log.i("CopyFile", "File not found " + ex.getMessage()); ex.printStackTrace(); } catch (IOException ex) { Log.i("CopyFile", "Transfer data error " + ex.getMessage()); ex.printStackTrace(); } }
From source file:RegexTestHarness2.java
private static void initResources() { try {/*from w w w.j a v a 2 s. co m*/ br = new BufferedReader(new FileReader("regex.txt")); } catch (FileNotFoundException fnfe) { System.out.println("Cannot locate input file! " + fnfe.getMessage()); System.exit(0); } try { REGEX = br.readLine(); INPUT = br.readLine(); } catch (IOException ioe) { } try { pattern = Pattern.compile(REGEX); matcher = pattern.matcher(INPUT); } catch (PatternSyntaxException pse) { System.out.println("There is a problem with the regular expression!"); System.out.println("The pattern in question is: " + pse.getPattern()); System.out.println("The description is: " + pse.getDescription()); System.out.println("The message is: " + pse.getMessage()); System.out.println("The index is: " + pse.getIndex()); System.exit(0); } System.out.println("Current REGEX is: " + REGEX); System.out.println("Current INPUT is: " + INPUT); }
From source file:com.googlecode.t7mp.util.ZipUtil.java
public static void unzip(InputStream warInputStream, File destination) { try {// w ww .j a va 2 s. c o m ZipArchiveInputStream in = null; try { in = new ZipArchiveInputStream(warInputStream); ZipArchiveEntry entry = null; while ((entry = in.getNextZipEntry()) != null) { File outfile = new File(destination.getCanonicalPath() + "/" + entry.getName()); outfile.getParentFile().mkdirs(); if (entry.isDirectory()) { outfile.mkdir(); continue; } OutputStream o = new FileOutputStream(outfile); try { IOUtils.copy(in, o); } finally { o.close(); } } } finally { if (in != null) { in.close(); } } warInputStream.close(); } catch (FileNotFoundException e) { throw new TomcatSetupException(e.getMessage(), e); } catch (IOException e) { throw new TomcatSetupException(e.getMessage(), e); } }
From source file:eu.delving.x3ml.X3MLCommandLine.java
static PrintStream rdf(String file) { if (file != null) { try {/*from w ww . j ava 2 s . c o m*/ return new PrintStream(new File(file)); } catch (FileNotFoundException e) { error(e.getMessage()); return null; } } else { return System.out; } }
From source file:be.vdab.util.Programma.java
private static TreeSet<Voertuig> lees(String file) {//gekozen voor treeSet , zo duidelijk dat er een TreeSet uitkomt (die serialiseerbaar is) TreeSet<Voertuig> voertuigen = null; ObjectInputStream ois = null; try {//from www .ja v a2 s . c om FileInputStream fis = new FileInputStream(file); ois = new ObjectInputStream(fis); voertuigen = (TreeSet<Voertuig>) ois.readObject();//je moet exact weten wat er is ingegaan, anders kan je object niet casten naar juiste klasse!? } catch (FileNotFoundException fnfe) { System.out.println(fnfe.getMessage()); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } catch (ClassNotFoundException cnfe) { System.out.println(cnfe.getMessage()); } finally { try { ois.close(); } catch (IOException ioe) { System.err.println(" ioe.getMessage()"); } } return voertuigen; }
From source file:com.clustercontrol.agent.util.AgentProperties.java
/** * Agent.properties????// w w w . ja va2s .c om * @param propFileName */ public static void init(String propFileName) { m_log.debug("init() : propFileName = " + propFileName); FileInputStream inputStream = null; try { inputStream = new FileInputStream(propFileName); // ??????? properties.load(inputStream); } catch (FileNotFoundException e) { m_log.error(e.getMessage(), e); } catch (IOException e) { m_log.error(e.getMessage(), e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { m_log.error(e.getMessage(), e); } } } }
From source file:com.ikon.util.Serializer.java
/** * @param obj//from w ww. j a v a 2 s. com */ public static void write(String filename, Object obj) { FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(Config.HOME_DIR + File.separator + filename + ".ser"); oos = new ObjectOutputStream(fos); oos.writeObject(obj); } catch (FileNotFoundException e) { log.error(e.getMessage()); } catch (IOException e) { log.error(e.getMessage()); } finally { IOUtils.closeQuietly(oos); IOUtils.closeQuietly(fos); } }
From source file:com.ikon.util.Serializer.java
/** * @param obj/* w w w . jav a2 s. c o m*/ */ public static Object read(String filename) { FileInputStream fis = null; ObjectInputStream ois = null; Object obj = null; try { fis = new FileInputStream(Config.HOME_DIR + File.separator + filename + ".ser"); ois = new ObjectInputStream(fis); obj = ois.readObject(); } catch (FileNotFoundException e) { log.error(e.getMessage()); } catch (IOException e) { log.error(e.getMessage()); } catch (ClassNotFoundException e) { log.error(e.getMessage()); } finally { IOUtils.closeQuietly(ois); IOUtils.closeQuietly(fis); } return obj; }
From source file:gr.kzps.FileCrypto.executor.Executor.java
/** * Call the dispatcher/*from w w w. j a va2s . co m*/ * * @param operation * Encryption or decryption * @param inputDir * Directory where the files to be encrypted/decrypted reside * @param outputDir * Output directory of the cryptographics operation * @param cryptoKey * Cryptographic key */ private static void callDispatcher(CryptoOperation operation, String inputDir, String outputDir, Integer threshold, String cryptoKey) { try { Dispatcher.dispatch(operation, inputDir, outputDir, threshold, cryptoKey); } catch (FileNotFoundException ex) { log.error("Error {}", new Object[] { ex.getMessage() }); } catch (NotDirectoryException ex) { log.error("Error {}", new Object[] { ex.getMessage() }); } catch (InterruptedException ex) { ex.printStackTrace(); } catch (NoCryptoKeyProvided ex) { log.error("Error {}", new Object[] { ex.getMessage() }); } }