private static FileObject oldDecode(URL u) { String resourceName = u.getFile(); if (resourceName.startsWith("/")) { resourceName = resourceName.substring(1); // NOI18N } // first part is FS name int first = resourceName.indexOf('/'); // NOI18N if (first == -1) { return null; } String fileSystemName = oldDecodeFSName(resourceName.substring(0, first)); resourceName = resourceName.substring(first); FileSystem fsys = Repository.getDefault().findFileSystem(fileSystemName); return (fsys == null) ? null : fsys.findResource(resourceName); }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); assert fsname != null : "Should always have a non-null fsname here"; @SuppressWarnings("deprecation") // historical part of serial form FileSystem fs = Repository.getDefault().findFileSystem(fsname); if (fs != null) { assert path != null : "Should always have a non-null path here"; f = fs.findResource(path); } if (f == null) { // Fall back to URL. assert url != null : "Should always have a non-null URL here"; f = URLMapper.findFileObject(url); if (f == null) { throw new FileNotFoundException("Could not restore: " + url); // NOI18N } } }
/** Finds the right file. */ public Object readResolve() { Repository rep = Repository.getDefault(); @SuppressWarnings("deprecation") // FileSystem.systemName historical part of serial form FileSystem fs = rep.findFileSystem(fsName); FileObject fo = null; if (fs != null) { // scan desired system fo = fs.findResource(fileName); } if (fo == null) { // create invalid file instead return new Invalid(fsName, fileName); } return fo; } }
/** * Gets FileObject for passed url. * @param url * @return appropriate FileObject. Can return null for other protocol than nbfs or * if such FileObject isn't reachable via Repository. */ static FileObject getFileObject(URL url) { if (!url.getProtocol().equals(FileURL.PROTOCOL)) { return null; } if (isOldEncoding(url)) { return oldDecode(url); } String[] urlParts = split(url); String fsName = decodeFsPart(urlParts[0]); String foName = decodeFoPart(urlParts[1]); FileSystem fsys = fsName.equals(SYSTEM_FILE_SYSTEM_NAME) ? Repository.getDefault().getDefaultFileSystem() : Repository.getDefault().findFileSystem(fsName); return (fsys == null) ? null : fsys.findResource(foName); }
private static FileObject oldDecode(URL u) { String resourceName = u.getFile(); if (resourceName.startsWith("/")) resourceName = resourceName.substring(1); // NOI18N // first part is FS name int first = resourceName.indexOf('/'); // NOI18N if (first == -1) return null; String fileSystemName = oldDecodeFSName(resourceName.substring(0, first)); resourceName = resourceName.substring(first); FileSystem fsys = ExternalUtil.getRepository().findFileSystem(fileSystemName); return (fsys == null) ? null : fsys.findResource(resourceName); }
private static FileObject oldDecode(URL u) { String resourceName = u.getFile(); if (resourceName.startsWith("/")) resourceName = resourceName.substring(1); // NOI18N // first part is FS name int first = resourceName.indexOf('/'); // NOI18N if (first == -1) return null; String fileSystemName = oldDecodeFSName(resourceName.substring(0, first)); resourceName = resourceName.substring(first); FileSystem fsys = ExternalUtil.getRepository().findFileSystem(fileSystemName); return (fsys == null) ? null : fsys.findResource(resourceName); }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); assert fsname != null : "Should always have a non-null fsname here"; FileSystem fs = Repository.getDefault().findFileSystem(fsname); if (fs != null) { assert path != null : "Should always have a non-null path here"; f = fs.findResource(path); } if (f == null) { // Fall back to URL. assert url != null : "Should always have a non-null URL here"; FileObject[] fos = URLMapper.findFileObjects(url); if (fos.length >= 1) { f = fos[0]; } else { throw new FileNotFoundException("Could not restore: " + url); // NOI18N } } }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); assert fsname != null : "Should always have a non-null fsname here"; FileSystem fs = Repository.getDefault().findFileSystem(fsname); if (fs != null) { assert path != null : "Should always have a non-null path here"; f = fs.findResource(path); } if (f == null) { // Fall back to URL. assert url != null : "Should always have a non-null URL here"; FileObject[] fos = URLMapper.findFileObjects(url); if (fos.length >= 1) { f = fos[0]; } else { throw new FileNotFoundException("Could not restore: " + url); // NOI18N } } }
/** Finds the right file. */ public Object readResolve () { Repository rep = ExternalUtil.getRepository (); FileSystem fs = rep.findFileSystem (fsName); FileObject fo = null; if (fs != null) { // scan desired system fo = fs.findResource (fileName); } if (fo == null) { // create invalid file instead return new Invalid (fsName, fileName); } return fo; }
/** Finds the right file. */ public Object readResolve () { Repository rep = ExternalUtil.getRepository (); FileSystem fs = rep.findFileSystem (fsName); FileObject fo = null; if (fs != null) { // scan desired system fo = fs.findResource (fileName); } if (fo == null) { // create invalid file instead return new Invalid (fsName, fileName); } return fo; }
/** * Gets FileObject for passed url. * @param url * @return appropriate FileObject. Can return null for other protocol than nbfs or * if such FileObject isn't reachable via Repository. */ static FileObject getFileObject(URL url) { if (!url.getProtocol().equals(FileURL.PROTOCOL)) return null; if (isOldEncoding(url)) { return oldDecode(url); } String[] urlParts = split(url); String fsName = decodeFsPart(urlParts[0]) ; String foName = decodeFoPart(urlParts[1]); FileSystem fsys = ExternalUtil.getRepository().findFileSystem(fsName); return (fsys == null) ? null : fsys.findResource(foName); }
/** * Gets FileObject for passed url. * @param url * @return appropriate FileObject. Can return null for other protocol than nbfs or * if such FileObject isn't reachable via Repository. */ static FileObject getFileObject(URL url) { if (!url.getProtocol().equals(FileURL.PROTOCOL)) return null; if (isOldEncoding(url)) { return oldDecode(url); } String[] urlParts = split(url); String fsName = decodeFsPart(urlParts[0]) ; String foName = decodeFoPart(urlParts[1]); FileSystem fsys = ExternalUtil.getRepository().findFileSystem(fsName); return (fsys == null) ? null : fsys.findResource(foName); }