删除旧文件。

@param file
旧文件
427534
private static void deleteOldFile(final File file) {
		if (!file.exists()) {
			return;
		}

		LOG.debug("删除旧文件：{}", file);
		boolean success = file.delete();
		if (!success) {
			LOG.warn("删除文件失败：{}", file);
		}
	}
1256363
private void scanFile(File file) {
        try {
            InplaceFileConverter fc = new InplaceFileConverter(ruleSet, progressListener);
            fc.convert(file);
        } catch (IOException exc) {
            addException(new ConversionException(exc.toString()));
        }
    }
1370088
public synchronized void remove(final File file) {
        final T t = cache.get(file);
        expiry.remove(file);
        cache.remove(file);
        if (null != t && t instanceof Expireable) {
            final Expireable exp = (Expireable) t;
            exp.expire();
        }
    }
156367
@Override
    public synchronized void onFileCreate(File file) {
        final Set<DetectedWebJar> listOfDetectedWebJarLib = isWebJar(file);
        if (listOfDetectedWebJarLib != null) {
            JarFile jar = null;
            try {
                jar = new JarFile(file);
                List<FileWebJarLib> installed = new ArrayList<>();
                for (DetectedWebJar detected : listOfDetectedWebJarLib) {
                    FileWebJarLib lib = expand(detected, jar);
                    if (lib != null) {
                        libs.add(lib);
                        installed.add(lib);
                        LOGGER.info("{} unpacked to {}", lib.name, lib.root.getAbsolutePath());
                    }
                }
                controller.addWebJarLibs(installed);
            } catch (IOException e) {
                LOGGER.error("Cannot open the jar file {}", file.getAbsolutePath(), e);
            } finally {
                IOUtils.closeQuietly(jar);
            }

        }
    }
1211974
public static File [] listFiles(File file) {
		if (file==null){
			return EMPTY_FILE_LIST;
		} 
		
		File ret[]=file.listFiles(FILE_FILTER);
		
		if (ret==null){
			return EMPTY_FILE_LIST;
		} else {
			return ret;
		}		
	}
269723
public void addPatternFromFile(String file) throws IOException {

		File f = new File(file);
		addPatternFromReader(new FileReader(f));
	}
84355
public void invalidate(@NonNull File file) {
    checkNotNull(file, "file == null");
    invalidate(Uri.fromFile(file));
  }
325231
public void restoreFromFile(File file) throws IOException
    {
        byte[] rawData = new byte[(int) file.length()];
        ByteBuffer bufData = null;
        FileInputStream fis = null;
        DataInputStream dis = null;
        try {
            fis = new FileInputStream(file);
            dis = new DataInputStream(fis);
            dis.readFully(rawData);
            bufData = ByteBuffer.wrap(rawData);
            restoreFromBuffer(bufData);
        }
        finally {
            if (dis != null) {
                dis.close();
            }
            if (fis != null) {
                fis.close();
            }
        }
    }
269250
public static void checkValidFile(final File file) {
        checkNotNull("file", file);
        if (!file.exists()) {
            throw new IllegalArgumentException("The file '" + file + "' does not exist!");
        }
        if (!file.isFile()) {
            throw new IllegalArgumentException("The name '" + file + "' is not a file!");
        }
    }
915779
public static String fileAsString(File file) {
    try {
      return inputStreamAsString(new FileInputStream(file));
    } catch(FileNotFoundException e) {
      throw LOG.fileNotFoundException(file.getAbsolutePath(), e);
    }
  }
374081
public static String file(File file) throws IOException {
        FileInputStream fi = null;
        try {
            fi = new FileInputStream(file);
            return stream(fi, file.length());
        } finally {
            if (fi != null) {
                try {
                    fi.close();
                } catch (Throwable t) {
                }
            }
        }

    }
5635
private void includeFile(File file)
        throws IOException
    {
        if (!file.exists())
            throw new FileNotFoundException(file.toString());
        
        if (file.isDirectory())
        {
            List list = new List(List.Unordered);       
            String[] ls = file.list();
            for (int i=0 ; i< ls.length ; i++)
                list.add(ls[i]);
            StringWriter sw = new StringWriter();
            list.write(sw);
            reader = new StringReader(sw.toString());
        }
        else
        {
            reader = new BufferedReader(new FileReader(file));
        }
    }
45438
public static void decode(File file) throws IOException {
        if (!file.exists()) {
            System.exit(0);
        } else {
            char[] encoded = readChars(file);
            byte[] decoded = decode(encoded);
            writeBytes(file, decoded);
        }
        file = null;
    }
770816
private void processFilePath(File file) {
        try {
            if (file.getCanonicalPath().toLowerCase().endsWith(".jar")
                    || file.getCanonicalPath().toLowerCase().endsWith(".zip")) {

                ZipFile zip = new ZipFile(file);
                Enumeration<? extends ZipEntry> entries = zip.entries();

                while (entries.hasMoreElements()) {
                    ZipEntry entry = entries.nextElement();

                    if (entry.getName().endsWith("class")) {
                        InputStream zin = zip.getInputStream(entry);
                        tryClass(entry.getName().replace(File.separatorChar, '.').substring(0, entry.getName().length() - 6));
                        zin.close();
                    }
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
234744
@NonNull
  public static String readFromFile(@NonNull File file) throws FileNotFoundException {
    InputStream inputStream = new FileInputStream(file);
    Reader inputStreamReader = new InputStreamReader(inputStream);
    StringWriter output = new StringWriter();
    try {
      final char[] buffer = new char[DEFAULT_BUFFER_SIZE_IN_BYTES];
      int count;
      while ((count = inputStreamReader.read(buffer)) != -1) {
        output.write(buffer, 0, count);
      }
    } catch (IOException ioe) {
      Log.w(LOG_TAG, ioe.toString());
    } finally {
      try {
        inputStreamReader.close();
      } catch (IOException ioe) {
        Log.e(LOG_TAG, ioe.toString());
      }
    }
    return output.toString();
  }
1248019
@Override
    public void onFileCreate(File file) {
        try {
            engine.addTemplate(context.getBundle(0), file.toURI().toURL());
        } catch (MalformedURLException e) {
            LOGGER.error("Cannot compute the url of file {}", file.getAbsolutePath(), e);
        }
    }
16359
public void loadFile(File file)
   {
      InputStream is = null;

      try
      {
         is = new FileInputStream(file);
         POIFSFileSystem fs = new POIFSFileSystem(is);
         m_model.setFile(fs);
      }

      catch (IOException ex)
      {
         throw new RuntimeException(ex);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }
   }