Package java.io

Examples of java.io.File.lastModified()


        File oCached = new File(sCacheFilesDir+File.separator+sCachedFile);

        if (!oCached.exists())
          oFS.mkdirs(sCacheFilesDir);
        else if (oCached.lastModified()>oDtModified.getTime())
          return oFS.readfilestr("file://"+sCacheFilesDir+File.separator+sCachedFile,
                                 sEncoding==null ? "ISO8859_1" : sEncoding);
      } catch (Exception xcpt) {
        System.err.println(xcpt.getClass().getName() + " " + xcpt.getMessage());
      }
View Full Code Here


        File oCached = new File(sCacheFilesDir+File.separator+sCachedFile);

        if (!oCached.exists())
          oFS.mkdirs(sCacheFilesDir);
        else if (oCached.lastModified()>oDtModified.getTime())
          return oFS.readfilestr("file://"+sCacheFilesDir+File.separator+sCachedFile,
                                 sEncoding==null ? "ISO8859_1" : sEncoding);
      } catch (Exception xcpt) {
        System.err.println(xcpt.getClass().getName() + " " + xcpt.getMessage());
      }
View Full Code Here

        File oCached = new File(sFileDir.substring(7)+File.separator+sCachedFile);

        if (!oCached.exists()) {
          oFS.mkdirs(sFileDir);
        }
        else if (oCached.lastModified()>oDtModified.getTime()) {
          sOutput = new String(oFS.readfile(sFileDir+File.separator+sCachedFile, sEncoding==null ? "ISO8859_1" : sEncoding));

          if (DebugFile.trace) {
            DebugFile.writeln("cache hit " + sFileDir+File.separator+sCachedFile);
            DebugFile.decIdent();
View Full Code Here

        try {
            if( FILENAME != null ) {
                File f = new File( FILENAME );
                long lm;

                if(( lm = f.lastModified() ) > lastModified ) {
                    lastModified = lm;
                    TAB.clear();
                    alt = 0;
                    populate( new FileReader( f ));
                }
View Full Code Here

                    final File bootstrapFile = new File(this.localArtifactDirectory, path);
                    final File repositoryFile = new File(
                            this.localRepository.getBasedir(),
                            newPath);
   
                    if (bootstrapFile.lastModified() > repositoryFile.lastModified())
                    {
                        this.getLog().info("Installing bootstrap artifact " + bootstrapFile + " to " + repositoryFile);
                        FileUtils.copyFile(
                            bootstrapFile,
                            repositoryFile);
View Full Code Here

        oFS.mkdirs(sFileDir);
      } catch (Exception xcpt) {
        throw new PortletException(xcpt.getMessage(), xcpt);
      }
    } else {
      bFetch = (new Date().getTime()-oCached.lastModified()>lRefreshEvery);
    }
     
  if (bFetch) {

      String sXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\"?>\n<folder account=\""+(null==sMailAccount ? "" : sMailAccount)+"\" name=\"inbox\">";
View Full Code Here

                }
                String elemName = element.getName();

                // If archive date is newer than unzipped file, overwrite
                File outFile = new File(unzippedDir, elemName);
                if (outFile.exists() && (outFile.lastModified() > warfileRef.lastModified())) {
                    continue;
                }
                outFile.getParentFile().mkdirs();
                byte buffer[] = new byte[8192];
View Full Code Here

        }

        // Send a 304 if not modified
        else if (!isInclude && (cachedResDate != -1)
                && (cachedResDate < (System.currentTimeMillis() / 1000L * 1000L))
                && (cachedResDate >= (res.lastModified() / 1000L * 1000L))) {
            String mimeType = getServletContext().getMimeType(
                    res.getName().toLowerCase());
            if (mimeType != null)
                response.setContentType(mimeType);
            response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
View Full Code Here

            InputStream resStream = new FileInputStream(res);

            response.setStatus(HttpServletResponse.SC_OK);
            response.setContentLength((int) res.length());
//            response.addHeader(ACCEPT_RANGES_HEADER, "bytes");
            response.addDateHeader(LAST_MODIFIED_DATE_HEADER, res.lastModified());
            OutputStream out = null;
            Writer outWriter = null;
            try {
                out = response.getOutputStream();
            } catch (IllegalStateException err) {
View Full Code Here

            response.addHeader(CONTENT_RANGE_HEADER, "bytes "
                    + rangeText.substring(1) + "/" + res.length());
            response.setContentLength(totalSent);

            response.addHeader(ACCEPT_RANGES_HEADER, "bytes");
            response.addDateHeader(LAST_MODIFIED_DATE_HEADER, res
                    .lastModified());
            OutputStream out = response.getOutputStream();
            int bytesRead = 0;
            for (Iterator i = ranges.iterator(); i.hasNext();) {
                String rangeBlock = (String) i.next();
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.