/** Find an appropriate instance of FileObject that addresses this URL * * @param url URL to be converted to file object * @return file object corresponding to URL or null if no one was found * @since 4.29 */ public static FileObject findFileObject(URL url) { if (url == null) { throw new NullPointerException("Cannot pass null URL to URLMapper.findFileObject"); // NOI18N } /** first basic implementation */ FileObject[] results = null; Iterator<URLMapper> instances = getInstances().iterator(); while (instances.hasNext() && ((results == null) || (results.length == 0))) { URLMapper mapper = instances.next(); results = mapper.getFileObjects(url); } return ((results != null) && (results.length > 0)) ? results[0] : null; }
/** Find an array of FileObjects for this URL. * Zero or more FOs may be returned. * * For each returned FO, it must be true that FO -> URL gives the * exact URL which was passed in, but depends on appropriate type * <code> findURL(FileObject fo, int type) </code>. * @param url to wanted FileObjects * @return a suitable array of FileObjects, or empty array if not successful * @since 2.22 * @deprecated Use {@link #findFileObject} instead. */ @Deprecated public static FileObject[] findFileObjects(URL url) { Set<FileObject> retSet = new LinkedHashSet<FileObject>(); for (URLMapper mapper: getInstances()) { FileObject[] retVal = mapper.getFileObjects(url); if (retVal != null) { retSet.addAll(Arrays.asList(retVal)); } } return retSet.toArray(new FileObject[retSet.size()]); }
/** Find a good URL for this file object which works according to type: * <ul> * <li>inside this VM * <li>inside this machine * <li>from networked machines * </ul> * @return a suitable URL, or (only if not {@link #INTERNAL}) null */ public static URL findURL(FileObject fo, int type) { /** secondly registered URLMappers are asked to resolve URL */ for (URLMapper mapper : getInstances()) { URL retVal = mapper.getURL(fo, type); if (retVal != null) { return retVal; } } // if not resolved yet then internal URL with nbfs protocol is returned // XXX this would be better handled by making DefaultURLMapper just return nbfs for INTERNAL when necessary! if (type == INTERNAL) { return FileURL.encodeFileObject(fo); } return null; }
FileObject[] retVal = null; Iterator instances = getInstances().iterator(); while (instances.hasNext()) { URLMapper mapper = (URLMapper) instances.next();
FileObject[] retVal = null; Iterator instances = getInstances().iterator(); while (instances.hasNext()) { URLMapper mapper = (URLMapper) instances.next();
/** Find an appropiate instance of FileObject that addresses this url * * @param url url to be converted to file object * @return file object corresponding to url or null if no one was found * @since 4.29 */ public static FileObject findFileObject(URL url) { if (url == null) { throw new NullPointerException("Cannot pass null URL to URLMapper.findFileObject"); // NOI18N } /** first basic implementation */ FileObject[] results = null; Iterator instances = getInstances().iterator(); while (instances.hasNext() && (results == null || results.length == 0)) { URLMapper mapper = (URLMapper) instances.next(); if (mapper == getDefault()) continue; results = mapper.getFileObjects(url); } /** first basic implementation */ if (results == null || results.length == 0) { results = getDefault().getFileObjects(url); } return (results != null && results.length > 0) ? results[0] : null; }
/** Find an appropiate instance of FileObject that addresses this url * * @param url url to be converted to file object * @return file object corresponding to url or null if no one was found * @since 4.29 */ public static FileObject findFileObject(URL url) { if (url == null) { throw new NullPointerException("Cannot pass null URL to URLMapper.findFileObject"); // NOI18N } /** first basic implementation */ FileObject[] results = null; Iterator instances = getInstances().iterator(); while (instances.hasNext() && (results == null || results.length == 0)) { URLMapper mapper = (URLMapper) instances.next(); if (mapper == getDefault()) continue; results = mapper.getFileObjects(url); } /** first basic implementation */ if (results == null || results.length == 0) { results = getDefault().getFileObjects(url); } return (results != null && results.length > 0) ? results[0] : null; }
Iterator instances = getInstances().iterator(); while (instances.hasNext()) { URLMapper mapper = (URLMapper) instances.next();
Iterator instances = getInstances().iterator(); while (instances.hasNext()) { URLMapper mapper = (URLMapper) instances.next();