Package java.io

Examples of java.io.File.lastModified()


              packageName = packageName.replace(File.separator, ".");
              String fileName = jarEntryName.substring(staticDirPos + ClassPathStaticDispatcher.STATIC_DIR_NAME.length());
              File targetFile = new File(classPathStaticDir, packageName + fileName);
              // Only do this if it does not already exist.
              // Use jar file last modified instead of jarEntry.getTime, seems to be unpredictable
              if (targetFile.exists() && targetFile.lastModified() >= sourceFile.lastModified()) {
                if (isLogDebugEnabled()) logDebug("Skipping static file from jar, filename::" + jarEntryName + " in jar::" + jar.getName()
                    + " - does already exist", null);
              } else {
                targetFile.getParentFile().mkdirs();
                BufferedInputStream inputStream = new BufferedInputStream(jar.getInputStream(jarEntry));
View Full Code Here


   */
  public Long getLastModifiedDate(Locale locale, String bundleName) {
    File baseDir = I18nModule.getPropertyFilesBaseDir(locale, bundleName);
    if (baseDir != null) {
      File propertyFile = getPropertiesFile(locale, bundleName, baseDir);
      return (propertyFile.lastModified());
    } else {
      // must be loaded from a jar, use startup date of VM
      return WebappHelper.getTimeOfServerStartup();
    }
  }
View Full Code Here

              if (entry == null) {
                logWarn("jar resource at location '"+location+"' and package " + packageName + " was not found, could not resolve entry relPath::" + relPath, null);
              } else {
                size = new Long(entry.getSize());
                // Last modified of jar - getTime on jar entry is not stable
                lastModified = Long.valueOf(jarFile.lastModified());             
                // Add to cache - no need to synchronize, just overwrite
                cachedJarResourceSize.put(fileName, size);
                cachedJarResourceLastModified.put(fileName, lastModified);
              }
            } catch (IOException e) {
View Full Code Here

          this.lastModified = WebappHelper.getTimeOfServerStartup();         
        }
      } else {
        // Get last modified and file size
        File f = new File(fileName);
        long lm = f.lastModified();
        this.lastModified = (lm != 0? lm : WebappHelper.getTimeOfServerStartup());
        if (f.exists()) {
          size = new Long(f.length());
        }       
      }     
View Full Code Here

        new Timer(true).schedule(new TimerTask() {
            @Override
            public void run() {
              // Ensure modification date is always growing in case system time was adjusted
              sessionTemporaryFolder.setLastModified(Math.max(System.currentTimeMillis(),
                  sessionTemporaryFolder.lastModified() + updateDelay));
            }
          }, updateDelay, updateDelay);
       
        if (siblingTemporaryFolders != null
            && siblingTemporaryFolders.length > 0) {
View Full Code Here

                  && cacheFolder.isDirectory())
                || cacheFolder.mkdirs())) {
          try {
            File cachedFile = new File(cacheFolder, extensionJarOrDllFileName);           
            if (!cachedFile.exists()
                || cachedFile.lastModified() < extensionJarOrDllFileDate) {
              // Copy jar to cache
              if (connection == null) {
                connection = extensionJarOrDllUrl.openConnection();
              }
              copyInputStreamToFile(connection.getInputStream(), cachedFile);
View Full Code Here

                } else {
                  Long lastMod = (Long) lastModifiedMap
                      .get(toCheck);
                  if (lastMod == null) {
                    lastModifiedMap.put(toCheck, new Long(
                        actual.lastModified()));
                  } else {
                    if (lastMod.longValue() != actual
                        .lastModified()) {
                      modified.add(actual);
                      lastModifiedMap.put(actual
View Full Code Here

                      .get(toCheck);
                  if (lastMod == null) {
                    lastModifiedMap.put(toCheck, new Long(
                        actual.lastModified()));
                  } else {
                    if (lastMod.longValue() != actual
                        .lastModified()) {
                      modified.add(actual);
                      lastModifiedMap.put(actual
                          .getAbsolutePath(),
                          new Long(actual
View Full Code Here

                    if (lastMod.longValue() != actual
                        .lastModified()) {
                      modified.add(actual);
                      lastModifiedMap.put(actual
                          .getAbsolutePath(),
                          new Long(actual
                              .lastModified()));
                    }
                  }
                }
              }
View Full Code Here

              newFiles.addAll(actualTable.values());
              currCIt = actualTable.values().iterator();
              while (currCIt.hasNext()) {
                File curr = (File) currCIt.next();
                lastModifiedMap.put(curr.getAbsolutePath(),
                    new Long(curr.lastModified()));
              }
              currentContent = (File[]) currContentTable.values()
                  .toArray(new File[currContentTable.size()]);
              Arrays.sort(currentContent, FILE_COMPARATOR);
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.