本文整理汇总了Java中java.net.URL.equals方法的典型用法代码示例。如果您正苦于以下问题:Java URL.equals方法的具体用法?Java URL.equals怎么用?Java URL.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.net.URL
的用法示例。
在下文中一共展示了URL.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findJavadoc
import java.net.URL; //导入方法依赖的package包/类
@Override
@CheckForNull
public JavadocForBinaryQuery.Result findJavadoc(@NonNull final URL b) {
final Boolean isNormalizedURL = isNormalizedURL(b);
if (isNormalizedURL != null) {
for (LibraryManager mgr : LibraryManager.getOpenManagers()) {
for (Library lib : mgr.getLibraries()) {
if (!lib.getType().equals(J2SELibraryTypeProvider.LIBRARY_TYPE)) {
continue;
}
for (URL entry : lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_CLASSPATH)) {
URL normalizedEntry;
if (isNormalizedURL == Boolean.TRUE) {
normalizedEntry = getNormalizedURL(entry);
} else {
normalizedEntry = entry;
}
if (b.equals(normalizedEntry)) {
return new R(lib);
}
}
}
}
}
return null;
}
示例2: setAvatar
import java.net.URL; //导入方法依赖的package包/类
private void setAvatar(JsonObject contentObject) {
if(contentObject.has("avatar_url") &&
contentObject.get("avatar_url").isJsonPrimitive()) {
try {
URL newAvatarUrl = new URL(contentObject.get("avatar_url").getAsString());
if(!newAvatarUrl.equals(avatarUrl)) {
avatarUrl.set(newAvatarUrl);
updateAvatar();
}
} catch (RestfulHTTPException | IOException e) {
avatar.set(null);
avatarUrl.set(null);
}
} else {
avatar.set(null);
avatarUrl.set(null);
}
}
示例3: setHelpURL
import java.net.URL; //导入方法依赖的package包/类
/** Setter for help URL.
* @param helpURL help URL
*/
public void setHelpURL(URL helpURL) {
if (htmlBrowser == null) {
return;
}
if (helpURL != null) {
if (!helpURL.equals(htmlBrowser.getDocumentURL())) {
htmlBrowser.setURL(helpURL);
}
if (tabbedPane != null) {
tabbedPane.setEnabledAt(tabbedPane.indexOfComponent(htmlBrowser), true);
}
} else if (tabbedPane != null) {
tabbedPane.setSelectedComponent(contentPanel);
tabbedPane.setEnabledAt(tabbedPane.indexOfComponent(htmlBrowser), false);
}
}
示例4: test
import java.net.URL; //导入方法依赖的package包/类
public static int test(URL documentBase, URL codeBase) {
int error = 0;
MLetContent mc = new MLetContent(
documentBase,
new HashMap<String,String>(),
new ArrayList<String>(),
new ArrayList<String>());
System.out.println("\nACTUAL DOCUMENT BASE = " + mc.getDocumentBase());
System.out.println("EXPECTED DOCUMENT BASE = " + documentBase);
if (!documentBase.equals(mc.getDocumentBase())) {
System.out.println("ERROR: Wrong document base");
error++;
};
System.out.println("ACTUAL CODEBASE = " + mc.getCodeBase());
System.out.println("EXPECTED CODEBASE = " + codeBase);
if (!codeBase.equals(mc.getCodeBase())) {
System.out.println("ERROR: Wrong code base");
error++;
};
return error;
}
示例5: forRuntime
import java.net.URL; //导入方法依赖的package包/类
/**
* Returns status of the artifact at relative path runtimePath in platform javaPlatform
* @param javaPlatform the {@link JavaPlatform} where the artifact is to be searched for
* @param runtimePath relative path to artifact
* @return status of artifact presence/inclusion in platform
*/
@NonNull
private static Support forRuntime(@NonNull final JavaPlatform javaPlatform, @NonNull final String runtimePath) {
Parameters.notNull("javaPlatform", javaPlatform); //NOI18N
Parameters.notNull("rtPath", runtimePath); //NOI18N
for (FileObject installFolder : javaPlatform.getInstallFolders()) {
final FileObject jfxrtJar = installFolder.getFileObject(runtimePath);
if (jfxrtJar != null && jfxrtJar.isData()) {
final URL jfxrtRoot = FileUtil.getArchiveRoot(jfxrtJar.toURL());
for (ClassPath.Entry e : javaPlatform.getBootstrapLibraries().entries()) {
if (jfxrtRoot.equals(e.getURL())) {
return Support.INCLUDED;
}
}
return Support.PRESENT;
}
}
return Support.MISSING;
}
示例6: serial
import java.net.URL; //导入方法依赖的package包/类
static void serial() throws IOException, MalformedURLException {
header("Serialization");
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bo);
URL u = new URL("http://java.sun.com/jdk/1.4?release#beta");
oo.writeObject(u);
oo.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
ObjectInputStream oi = new ObjectInputStream(bi);
try {
Object o = oi.readObject();
u.equals(o);
} catch (ClassNotFoundException x) {
x.printStackTrace();
throw new RuntimeException(x.toString());
}
}
示例7: isInClassPath
import java.net.URL; //导入方法依赖的package包/类
/**
* Returns true if the specified location is in the JVM classpath. This may ignore additions to
* the classpath that are not reflected by the value in
* <code>System.getProperty("java.class.path")</code>.
*
* @param location the directory or jar URL to test for
* @return true if location is in the JVM classpath
* @throws MalformedURLException
*/
public static boolean isInClassPath(URL location) throws MalformedURLException {
String classPath = System.getProperty("java.class.path");
StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator);
while (st.hasMoreTokens()) {
String path = st.nextToken();
if (location.equals(new File(path).toURI().toURL())) {
return true;
}
}
return false;
}
示例8: removeDirectory
import java.net.URL; //导入方法依赖的package包/类
/**
* Removes a CREOLE directory from the set of loaded directories.
*
* @param directory
*/
@Override
public void removeDirectory(URL directory) {
if(directory == null) return;
for(Plugin plugin : plugins) {
if(directory.equals(plugin.getBaseURL())) {
unregisterPlugin(plugin);
break;
}
}
}
示例9: containsRoot
import java.net.URL; //导入方法依赖的package包/类
/**
* Queries the provider if already contains given source root.
* @param provider
* @param root
* @return <tt>true</tt> if provider already contains the root.
*/
public static boolean containsRoot(SourceRootsProvider provider, URL root) {
org.openide.util.Parameters.notNull("provider", provider); // NOI18N
org.openide.util.Parameters.notNull("root", root); // NOI18N
for (URL r2 : provider.getSourceRoots()) {
if (root.equals(r2))
return true;
}
return false;
}
示例10: hasSourceCache
import java.net.URL; //导入方法依赖的package包/类
private static boolean hasSourceCache(
@NonNull final ClasspathInfo cpInfo,
@NonNull final APTUtils aptUtils) {
final List<? extends ClassPath.Entry> entries = ClasspathInfoAccessor.getINSTANCE().getCachedClassPath(cpInfo, PathKind.SOURCE).entries();
if (entries.isEmpty()) {
return false;
}
final URL sourceRoot = aptUtils.getRoot().toURL();
for (ClassPath.Entry entry : entries) {
if (sourceRoot.equals(entry.getURL())) {
return true;
}
}
return false;
}
示例11: hasChanged
import java.net.URL; //导入方法依赖的package包/类
private boolean hasChanged(List<PathResourceImplementation> oldValues,
List<PathResourceImplementation> newValues) {
if (oldValues == null) {
return (newValues != null);
}
Iterator<PathResourceImplementation> it = oldValues.iterator();
ArrayList<PathResourceImplementation> nl = new ArrayList<PathResourceImplementation>();
nl.addAll(newValues);
while (it.hasNext()) {
PathResourceImplementation res = it.next();
URL oldUrl = res.getRoots()[0];
boolean found = false;
if (nl.isEmpty()) {
return true;
}
Iterator<PathResourceImplementation> inner = nl.iterator();
while (inner.hasNext()) {
PathResourceImplementation res2 = inner.next();
URL newUrl = res2.getRoots()[0];
if (newUrl.equals(oldUrl)) {
inner.remove();
found = true;
break;
}
}
if (!found) {
return true;
}
}
if (!nl.isEmpty()) {
return true;
}
return false;
}
示例12: testURLNoInetAccess
import java.net.URL; //导入方法依赖的package包/类
public void testURLNoInetAccess() throws MalformedURLException, IOException {
URL url1 = new URL ("nbinst://test-module/modules/test.txt"); // NOI18N
URL url2 = new URL ("nbinst://foo-module/modules/test.txt"); // NOI18N
SecurityManager defaultManager = System.getSecurityManager();
System.setSecurityManager(new InetSecurityManager());
try {
// make sure we do not try to resolve host name
url1.hashCode();
url1.equals(url2);
testURLConnection();
} finally {
System.setSecurityManager(defaultManager);
}
}
示例13: updateIndex
import java.net.URL; //导入方法依赖的package包/类
@Override
public boolean updateIndex(URL sourceRoot, URL indexFolder) {
boolean vote = true;
lck.lock();
try {
if (sourceRoot.equals(expectedSourceRoot)) {
expectedSourceRoot = null;
vote = expectedVote;
cnd.signal();
}
} finally {
lck.unlock();
}
return vote;
}
示例14: testImageNameTo2xParsing
import java.net.URL; //导入方法依赖的package包/类
static void testImageNameTo2xParsing() throws Exception {
for (String[] testNames : TEST_FILE_NAMES) {
String testName = testNames[0];
String goldenName = testNames[1];
String resultName = getTestScaledImageName(testName);
if (!isValidPath(testName) && resultName == null) {
continue;
}
if (goldenName.equals(resultName)) {
continue;
}
throw new RuntimeException("Test name " + testName
+ ", result name: " + resultName);
}
for (URL[] testURLs : TEST_URLS) {
URL testURL = testURLs[0];
URL goldenURL = testURLs[1];
URL resultURL = getTestScaledImageURL(testURL);
if (!isValidPath(testURL.getPath()) && resultURL == null) {
continue;
}
if (goldenURL.equals(resultURL)) {
continue;
}
throw new RuntimeException("Test url: " + testURL
+ ", result url: " + resultURL);
}
}
示例15: testImageNameTo2xParsing
import java.net.URL; //导入方法依赖的package包/类
static void testImageNameTo2xParsing() throws Exception {
for (String[] testNames : TEST_FILE_NAMES) {
String testName = testNames[0];
String goldenName = testNames[1];
String resultName = getTestScaledImageName(testName);
if (!isValidPath(testName) && resultName == null) {
continue;
}
if (goldenName.equals(resultName)) {
continue;
}
throw new RuntimeException("Test name " + testName
+ ", result name: " + resultName);
}
for (URL[] testURLs : TEST_URLS) {
URL testURL = testURLs[0];
URL goldenURL = testURLs[1];
URL resultURL = getTestScaledImageURL(testURL);
if (!isValidPath(testURL.getPath()) && resultURL == null) {
continue;
}
if (goldenURL.equals(resultURL)) {
continue;
}
throw new RuntimeException("Test url: " + testURL
+ ", result url: " + resultURL);
}
}