Loads a Saveable object from its default location or returns {@code null} when the file doesn't exist.
970258
public static @CheckForNull <T extends Saveable> T load(@Nonnull Class<T> clazz) throws IOException {
        XmlFile file = getConfigFile(clazz);
        return file.exists() ? clazz.cast(file.read()) : null;
    }
1135109
def load(self, name, location='local'):
        """"""
        path = self._get_path(name, location, file_ext='.json')
        if op.exists(path):
            return _load_json(path)
        path = self._get_path(name, location, file_ext='.pkl')
        if op.exists(path):
            return _load_pickle(path)
        logger.debug("The file `%s` doesn't exist.", path)
        return {}
1123419
function load(schema) {
  var obj;
  if (typeof schema == 'string' && schema !== 'null') {
    try {
      obj = JSON.parse(schema);
    } catch (err) {
      // No file loading here.
    }
  }
  if (obj === undefined) {
    obj = schema;
  }
  return obj;
}
1167385
private DefaultLocalExtension loadDescriptor(File descriptor) throws InvalidExtensionException
    {
        FileInputStream fis;
        try {
            fis = new FileInputStream(descriptor);
        } catch (FileNotFoundException e) {
            throw new InvalidExtensionException("Failed to open descriptor for reading", e);
        }

        try {
            DefaultLocalExtension localExtension =
                this.extensionSerializer.loadLocalExtensionDescriptor(this.repository, fis);

            localExtension.setDescriptorFile(descriptor);
            localExtension.setFile(getFile(descriptor, DESCRIPTOR_EXT, localExtension.getType()));

            if (!localExtension.getFile().getFile().exists()) {
                throw new InvalidExtensionException("Failed to load local extension [" + descriptor + "]: ["
                    + localExtension.getFile() + "] file does not exists");
            }

            return localExtension;
        } finally {
            try {
                fis.close();
            } catch (IOException e) {
                LOGGER.error("Failed to close stream for file [" + descriptor + "]", e);
            }
        }
    }
331356
private static File getFile(URL resourceUrl) {
    try {
      return new File(new URI(resourceUrl.toString()).getPath());
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    } catch (NullPointerException npe) {
      LOG.error("NullPointerException is thrown. Resource url: {} ", resourceUrl);
      throw new RuntimeException(npe);
    }
  }
1004591
@Override
    public File findFile(RepositoryPointerImpl location) {
        // Assume that instanceIds are good and check fileId only.
        File result = getChild(location.getFileId());
        return isFile(result) ? result : null;
    }
1333553
@Override
  public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) {
    try {
      final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class));
      if ((stateProvider != null)) {
        final ResourceStorageLoadable inputStream = stateProvider.getResourceStorageLoadable(resource);
        if ((inputStream != null)) {
          return inputStream;
        }
      }
      InputStream _xifexpression = null;
      boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.<Object, Object>emptyMap());
      if (_exists) {
        _xifexpression = resource.getResourceSet().getURIConverter().createInputStream(this.getBinaryStorageURI(resource.getURI()));
      } else {
        InputStream _xblockexpression = null;
        {
          final AbstractFileSystemAccess2 fsa = this.getFileSystemAccess(resource);
          final String outputRelativePath = this.computeOutputPath(resource);
          _xblockexpression = fsa.readBinaryFile(outputRelativePath);
        }
        _xifexpression = _xblockexpression;
      }
      final InputStream inputStream_1 = _xifexpression;
      return this.createResourceStorageLoadable(inputStream_1);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
69681
public void loadParamFile() throws IOException {
		SeekableLineReaderFactory fact = null;
		SeekableLineReaderIterator iter = null;

		try {
			fact = GeneralURIStreamFactory.createSeekableStreamFactory(
				paramFile, false);
			iter = new SeekableLineReaderIterator(fact.get());

			paramSet = new HashSet<String>();

			while (iter.hasNext()) {
				String param = iter.next();
				param = param.trim();

				if (param.isEmpty() || param.startsWith("#")) {
					continue;
				}

				// Use only the first word, ignore the rest
				int wordEnd = param.indexOf(delim);

				if (wordEnd > 0) {
					param = param.substring(0, wordEnd);
				}

				paramSet.add(param);
			}
		} finally {
			if (iter != null) {
				iter.close();
			}

			if (fact != null) {
				fact.close();
			}
		}
	}
142661
private T loadFileValue(final File file)
	{
		final boolean reload;

		// First time / first time with this file
		if (cached == null || lastFile == null || lastFileModified == null || !lastFile.equals(file))
		{
			lastFile = file;
			lastFileModified = file.lastModified();
			reload = true;
		}
		else // Same file, so check timestamp to decide on reload
		{
			final long modified = file.lastModified();

			reload = modified > lastFileModified;

			if (reload)
				lastFileModified = modified;
		}

		if (reload)
		{
			cached = null; // Prevent the old value from being used

			setCached(clazz.cast(factory.getInstance(clazz).deserialise(file)));
		}

		return cached;
	}
1301529
function load(schema) {
  var obj;
  if (typeof schema == 'string' && schema !== 'null') {
    // This last predicate is to allow `avro.parse('null')` to work similarly
    // to `avro.parse('int')` and other primitives (null needs to be handled
    // separately since it is also a valid JSON identifier).
    try {
      obj = JSON.parse(schema);
    } catch (err) {
      if (~schema.indexOf('/')) {
        // This can't be a valid name, so we interpret is as a filepath. This
        // makes is always feasible to read a file, independent of its name
        // (i.e. even if its name is valid JSON), by prefixing it with `./`.
        obj = JSON.parse(fs.readFileSync(schema));
      }
    }
  }
  if (obj === undefined) {
    obj = schema;
  }
  return obj;
}
759
private Image loadImage(Resource path) throws IOException {
		URL url = path.getURL();
		if (url == null) {
			logger.warn("Unable to locate splash screen in classpath at: " + path);
			return null;
		}
		return Toolkit.getDefaultToolkit().createImage(url);
	}
551050
private Image loadImage(final String resourceName, final boolean skipImagesFolder) {
        Image image = null;

        final List<String> imagePaths = skipImagesFolder ? Collections.singletonList("") : ResourceParameters.IMAGE_FOLDER.get();
        for (int i = 0; i < imagePaths.size() && image == null; i++) {

            String imagePath = imagePaths.get(i);
            if (!imagePath.isEmpty()) {
                imagePath += Resources.PATH_SEP;
            }
            final InputStream imageInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(imagePath + resourceName);
            if (imageInputStream != null) {
                image = new Image(imageInputStream);
            }
        }
        if (image == null) {
            LOGGER.error("Image : {} not found into base folder: {}", resourceName, ResourceParameters.IMAGE_FOLDER.get());
        }
        return image;
    }
441819
protected File getFileRoot(Class type) {
        String path = getGroupsRootPath() + type.getName();
        File f = new File(path);
        return (f.exists()) ? f : null;
    }
929848
public void load() throws FileNotFoundException {

        XMLObjectReader reader = null;
        try {
            this.preparePersistFile();

            File f = new File(persistFile.toString());
            if (f.exists()) {
                // we have V2 config
                loadVer2(persistFile.toString());
            } else {
                String s1 = persistFile.toString().replace("1.xml", ".xml");
                f = new File(s1);

                if (f.exists()) {
                    loadVer1(s1);
                }

                this.store();
                f.delete();
            }
        } catch (XMLStreamException ex) {
            logger.error(String.format("Failed to load the M3UA configuration file. \n%s", ex.getMessage()));
        } catch (FileNotFoundException e) {
            logger.warn(String.format("Failed to load the M3UA configuration file. \n%s", e.getMessage()));
        } catch (IOException e) {
            logger.error(String.format("Failed to load the M3UA configuration file. \n%s", e.getMessage()));
        }
    }
1067663
@Override
    File getFile() {
        try {
            final URI uri = moduleRef.getLocation();
            if (uri != null && !uri.getScheme().equals("jrt")) {
                final File file = new File(uri);
                if (file.exists()) {
                    return file;
                }
            }
        } catch (final Exception e) {
            // Invalid "file:" URI
        }
        return null;
    }
1118192
function() {
				var file = this.getSource().getSource();
				return o.inArray(o.typeOf(file), ['blob', 'file']) !== -1 ? file : null;
			}
688924
private void load() {
        InputStream propertiesInputStream = null;
        try {
            propertiesInputStream = propertiesInputStream();
            if (propertiesInputStream == null) {
                throw new IllegalArgumentException("The properties file could not be loaded!");
            }
            properties.load(propertiesInputStream);
        } catch (IOException e) {
            LOGGER.error("Can't load properties", e);
        } finally {
            try {
                if (propertiesInputStream != null) {
                    propertiesInputStream.close();
                }
            } catch (IOException e) {
                LOGGER.error("Can't close the properties InputStream", e);
            }
        }
    }