/** * Returns the extraction result in the requested file in the disk cache, or <code>null</code> if the * file is not found in the cache, or is found but out-dated.<p> * * @param rfsName the file RFS name to look up in the cache * * @return the extraction result stored in the requested file in the RFS disk cache, or <code>null</code> */ public CmsExtractionResult getCacheObject(String rfsName) { try { File f = new File(rfsName); if (f.exists()) { long age = f.lastModified(); if ((System.currentTimeMillis() - age) > 3600000) { // file has not been touched for 1 hour, touch the file with the current date f.setLastModified(System.currentTimeMillis()); } byte[] byteContent = CmsFileUtil.readFile(f); return CmsExtractionResult.fromBytes(byteContent); } } catch (IOException e) { // unable to read content } // this code can be reached only in case of an error return null; }
/** * Returns the extraction result in the requested file in the disk cache, or <code>null</code> if the * file is not found in the cache, or is found but out-dated.<p> * * @param rfsName the file RFS name to look up in the cache * * @return the extraction result stored in the requested file in the RFS disk cache, or <code>null</code> */ public CmsExtractionResult getCacheObject(String rfsName) { try { File f = new File(rfsName); if (f.exists()) { long age = f.lastModified(); if ((System.currentTimeMillis() - age) > 3600000) { // file has not been touched for 1 hour, touch the file with the current date f.setLastModified(System.currentTimeMillis()); } byte[] byteContent = CmsFileUtil.readFile(f); return CmsExtractionResult.fromBytes(byteContent); } } catch (IOException e) { // unable to read content } // this code can be reached only in case of an error return null; }
content = CmsExtractionResult.fromBytes(oldDoc.getContentBlob());
content = CmsExtractionResult.fromBytes(oldContent);