if (info.folder(fullName)) { if (map.size() == 0) { pw = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(info.outputStream(safeName)), "UTF8")); // NOI18N map.writeToXML(pw); pw.flush();
((NotifyInputStream) retVal).setOriginal(abstractFileSystem.info.inputStream(fo.getPath())); } else { retVal = new InputStream() {
return; } else { l = getAbstractFileSystem().info.lastModified(getPath());
lastModified = l = getAbstractFileSystem().info.lastModified(getPath()); return; } else l = getAbstractFileSystem().info.lastModified(getPath());
lastModified = l = getAbstractFileSystem().info.lastModified(getPath()); return; } else l = getAbstractFileSystem().info.lastModified(getPath());
if (info.folder (fullName)) { if (map.size () == 0) { pw = new PrintWriter(new OutputStreamWriter (new BufferedOutputStream(info.outputStream (safeName)),"UTF8")); // NOI18N map.writeToXML(pw); pw.flush();
if (info.folder (fullName)) { if (map.size () == 0) { pw = new PrintWriter(new OutputStreamWriter (new BufferedOutputStream(info.outputStream (safeName)),"UTF8")); // NOI18N map.writeToXML(pw); pw.flush();
((NotifyOutputStream)retVal).setOriginal (abstractFileSystem.info.outputStream(fo.getPath())); } else { retVal = new OutputStream() {
((NotifyInputStream)retVal).setOriginal (abstractFileSystem.info.inputStream(fo.getPath())); } else { retVal = new InputStream() {
((NotifyOutputStream)retVal).setOriginal (abstractFileSystem.info.outputStream(fo.getPath())); } else { retVal = new OutputStream() {
((NotifyInputStream)retVal).setOriginal (abstractFileSystem.info.inputStream(fo.getPath())); } else { retVal = new InputStream() {
is = info.inputStream (f+"/"+"_nbattrs."); os = info.outputStream (f+"/"+getFileName());
is = info.inputStream (f+"/"+"_nbattrs."); os = info.outputStream (f+"/"+getFileName());
/** Loads the table. Does no initialization. */ private Table load (String name) { String acceptNames[] = {(name.length()==0 ? "": (name + '/')) + getFileName(),// NOI18N (name.length()==0 ? "": (name + '/')) + ATTR_NAME_EXT}; // NOI18N for (int i = 0; i < acceptNames.length;i++) { if (info.size (acceptNames[i]) > 0L) { try { InputStream fis = info.inputStream (acceptNames[i]); try { return loadTable (fis,acceptNames[i]); } finally { try { fis.close (); } catch (IOException e) { // ignore--who cares? } } } catch (FileNotFoundException ex) { ExternalUtil.exception(ex); } } } return new Table (); }
public Object readAttribute(String name, String attrName) { Table t; String[] arr = new String[2]; split (name, arr); /** At the momement substitutes lack of API */ if (attrName.equals (READONLY_ATTRIBUTES)) return info.readOnly(arr[0]) ? Boolean.TRUE : Boolean.FALSE; synchronized (this) { // synchronized so only one table for each folder // can exist t = loadTable (arr[0]); } // JST: // had to split the code to do getAttr out of synchronized block // because the attribute can be serialized FileObject and // so the code returns back to FileSystem (that is usually synchronized) // // this leads to deadlocks between FS & DefaultAttributes implementation // // I do not know if the table should not be somehow synchronized, // but it seems ok. return t.getAttr (arr[1], attrName); }
/** Loads the table. Does no initialization. */ private Table load (String name) { String acceptNames[] = {(name.length()==0 ? "": (name + '/')) + getFileName(),// NOI18N (name.length()==0 ? "": (name + '/')) + ATTR_NAME_EXT}; // NOI18N for (int i = 0; i < acceptNames.length;i++) { if (info.size (acceptNames[i]) > 0L) { try { InputStream fis = info.inputStream (acceptNames[i]); try { return loadTable (fis,acceptNames[i]); } finally { try { fis.close (); } catch (IOException e) { // ignore--who cares? } } } catch (FileNotFoundException ex) { ExternalUtil.exception(ex); } } } return new Table (); }
public Object readAttribute(String name, String attrName) { Table t; String[] arr = new String[2]; split (name, arr); /** At the momement substitutes lack of API */ if (attrName.equals (READONLY_ATTRIBUTES)) return info.readOnly(arr[0]) ? Boolean.TRUE : Boolean.FALSE; synchronized (this) { // synchronized so only one table for each folder // can exist t = loadTable (arr[0]); } // JST: // had to split the code to do getAttr out of synchronized block // because the attribute can be serialized FileObject and // so the code returns back to FileSystem (that is usually synchronized) // // this leads to deadlocks between FS & DefaultAttributes implementation // // I do not know if the table should not be somehow synchronized, // but it seems ok. return t.getAttr (arr[1], attrName); }
/** Unlocks the file. Notifies the underlaying impl. */ synchronized void unlock (FileLock fLock) { FileLock currentLock = null; if (lock != null) { currentLock = (FileLock)lock.get(); } if (currentLock == fLock) { getAbstractFileSystem ().info.unlock (getPath ()); lastModified = null; if (isValid ()) { lastModified (); } // clear my lock lock = null; } }
/** Unlocks the file. Notifies the underlaying impl. */ synchronized void unlock (FileLock fLock) { FileLock currentLock = null; if (lock != null) { currentLock = (FileLock)lock.get(); } if (currentLock == fLock) { getAbstractFileSystem ().info.unlock (getPath ()); lastModified = null; if (isValid ()) { lastModified (); } // clear my lock lock = null; } }
public synchronized FileLock lock () throws IOException { if (lock != null) { FileLock f = (FileLock)lock.get (); if (f != null) { // System.out.println ("Already locked: " + this); // NOI18N throw new FileAlreadyLockedException(); } } getAbstractFileSystem ().info.lock (getPath ()); FileLock l = new AfLock (); lock = new WeakReference (l); // Thread.dumpStack (); // System.out.println ("Locking file: " + this); // NOI18N return l; }