Does resource exist?

@param res the res
@return the boolean
544420
public static boolean doesResourceExist(final Resource res) {
        if (res != null) {
            try {
                IOUtils.read(res.getInputStream(), new byte[1]);
                return res.contentLength() > 0;
            } catch (final FileNotFoundException e) {
                LOGGER.trace(e.getMessage());
                return false;
            } catch (final Exception e) {
                LOGGER.trace(e.getMessage(), e);
                return false;
            }
        }
        return false;
    }
721572
protected boolean containsResource(CmsResource res) {

        return m_deletedFolderList.contains(res) || m_folderList.contains(res) || m_fileList.contains(res);
    }
791536
public boolean exists() throws APIException {
        HttpResponse response = client.head(getUrl());
        int status = response.getStatusLine().getStatusCode();
        if(status != 200 && status != 404) {
            throw APIException.fromHttpResponse(response);
        }
        return (200 == status);
    }
68112
public boolean exists() {
		// Try file existence: can we find the file in the file system?
		try {
			return getFile().exists();
		}
		catch (IOException ex) {
			// Fall back to stream existence: can we open the stream?
			try {
				InputStream is = getInputStream();
				is.close();
				return true;
			}
			catch (Throwable isEx) {
				return false;
			}
		}
	}
227084
public boolean containsKey(String key) {

        if (key == null) {
            throw new NullPointerException("Missing resource key.");
        }

        PropertyBundle p = this;

        do {
            String value = p.key2values.get(key);
            if (value != null) {
                return true;
            }
        } while ((p = p.parent) != null);

        return false;

    }
1319432
protected boolean resourceIsValid(CmsResource resource) {

        if (!resource.getRootPath().startsWith(m_basePath)) {
            return false;
        }
        if (m_requireFile & resource.isFolder()) {
            return false;
        }
        if (m_requireFolder & resource.isFile()) {
            return false;
        }
        return true;
    }
136985
def resource_exists(self, name):
        """"""
        if name not in self.available:
            try:
                get_zoneinfo().getinfo('zoneinfo/' + name)
                self.available[name] = True
            except KeyError:
                self.available[name] = False

        return self.available[name]
111130
public boolean existRunnableNodes(ResourceType type) {
    RunnableIndices r = typeToIndices.get(type);
    return r.existRunnableNodes();
  }
1179118
def check_exists(self):

		'''
		
		'''

		response = self.repo.api.http_request('HEAD', self.uri)
		self.status_code = response.status_code
		# resource exists
		if self.status_code == 200:
			self.exists = True
		# resource no longer here
		elif self.status_code == 410:
			self.exists = False
		# resource not found
		elif self.status_code == 404:
			self.exists = False
		return self.exists
733423
public ResponseBuilder deleteResource(final Resource res) {
        final String baseUrl = getBaseUrl();
        final String identifier = baseUrl + req.getPartition() + req.getPath();

        final Session session = ofNullable(req.getSession()).orElseGet(HttpSession::new);

        // Check if this is already deleted
        checkDeleted(res, identifier);

        // Check the cache
        final EntityTag etag = new EntityTag(md5Hex(res.getModified() + identifier));
        checkCache(req.getRequest(), res.getModified(), etag);

        LOGGER.debug("Deleting {}", identifier);

        try (final TrellisDataset dataset = TrellisDataset.createDataset()) {

            // Add the audit quads
            audit.ifPresent(svc -> svc.deletion(res.getIdentifier(), session).stream()
                    .map(skolemizeQuads(resourceService, baseUrl)).forEachOrdered(dataset::add));

            // When deleting just the ACL graph, keep the user managed triples in tact
            if (ACL.equals(req.getExt())) {
                try (final Stream<? extends Triple> triples = res.stream(PreferUserManaged)) {
                    triples.map(t -> rdf.createQuad(PreferUserManaged, t.getSubject(), t.getPredicate(), t.getObject()))
                        .forEachOrdered(dataset::add);
                }
            }

            // delete the resource
            if (resourceService.put(res.getIdentifier(), dataset.asDataset())) {
                return status(NO_CONTENT);
            }
        }

        LOGGER.error("Unable to delete resource at {}", res.getIdentifier());
        return serverError().entity("Unable to delete resource. Please consult the logs for more information");
    }
487540
public final boolean handle(HttpServletRequest req, HttpServletResponse res) {
		return handle(req, res, Request.getPath(req));
	}
922272
public boolean checkResources(RequiredOrientResource[] resources, Action action)
	{
		for (int i = 0; i < resources.length; i++) {
			RequiredOrientResource requiredOrientResource = resources[i];
			if(!checkResource(requiredOrientResource, action)) return false;
		}
		return true;
	}
1016703
public boolean exists() {
		try {
			read();
			return true;
		} catch (FileFormatException e) {
			return false;
		} catch (IOException e) {
			logger.error(e);
			return false;
		}
	}
936148
private InputStream openResource(String name) throws IOException {
        if (mAppContext == null) {
            throw new RuntimeException("Need to call JodaTimeAndroid.init() before using joda-time-android");
        }

        String resName = ResUtils.getTzResource(name);
        int resId = ResUtils.getIdentifier(R.raw.class, resName);

        if (resId == 0) {
            throw new IOException("Resource not found: \"" + name + "\" (resName: \"" + resName + "\")");
        }

        InputStream in = mAppContext.getResources().openRawResource(resId);

        return in;
    }
712452
private boolean add(ResourceInternal<T> resource) {
    try {
      mLock.lock();
      if (mResources.size() >= mMaxCapacity) {
        return false;
      } else {
        mResources.put(resource.mResource, resource);
        return true;
      }
    } finally {
      mLock.unlock();
    }
  }
912726
public static boolean isJavaFile(IResource resource) {
        if (resource == null || (resource.getType() != IResource.FILE)) {
            return false;
        }
        String ex = resource.getFileExtension();
        return "java".equalsIgnoreCase(ex); //$NON-NLS-1$
    }
1323462
public static boolean isResourceLocalToServer(URI resourceUri, URI serverUri) {
        URI relativeUri = serverUri.relativize(resourceUri);
        return !relativeUri.isAbsolute();
    }