本文整理匯總了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);
}
}