private FileChannel updateCache(String filePath){
  FileChannel fileChannel=fileNameAndStreamCache.get(filePath);
  try {
    if (null == fileChannel) {
      FileInputStream stream=new FileInputStream(filePath);
      fileChannel=stream.getChannel();
      fileNameAndStreamCache.put(filePath,fileChannel);
    }
  }
 catch (  IOException e) {
    LOGGER.error(e,e.getMessage());
  }
  return fileChannel;
}

private FileChannel updateCache ( String filePath ) { FileChannel fileChannel = fileNameAndStreamCache . get ( filePath ) ; try { if ( null == fileChannel ) { FileInputStream stream = new FileInputStream ( filePath ) ; fileChannel = stream . getChannel ( ) ; fileNameAndStreamCache . put ( filePath , fileChannel ) ; } } catch ( IOException e ) { LOGGER . error ( e , e . getMessage ( ) ) ; } return fileChannel ; }
this method will be used to check whether stream is already present in cache or not for filepath if not present then create it and then add to cache , other wise get from cache
