/** performance hack */ final Object getAttribute(String attrName, String path) { return XMLMapAttr.readAttribute(this, getAbstractFileSystem().attr, path, attrName); }
/** Creates Reference. In FileSystem, which subclasses AbstractFileSystem, you can overload method * createReference(FileObject fo) to achieve another type of Reference (weak, strong etc.) * @param fo FileObject * @return Reference to FileObject */ protected final Reference<AbstractFolder> createReference(AbstractFolder fo) { return (getAbstractFileSystem().createReference(fo)); }
/** Method to create a file object for given subfile. * @param name of the subfile * @return the file object */ protected final AbstractFolder createFile(String name) { return getAbstractFileSystem().createFileObject(this, name); }
final Enumeration<String> getAttributes(String path) { return getAbstractFileSystem().attr.attributes(path); }
public boolean isFolder() { if (folder == null) { if ((parent == null) || getAbstractFileSystem().info.folder(getPath())) { folder = Boolean.TRUE; return true; } else { folder = Boolean.FALSE; return false; } } else { return folder.booleanValue(); } }
@Deprecated // have to override for compat public void setImportant(boolean b) { getAbstractFileSystem().markImportant(getPath(), b); }
/** Method that allows subclasses to return its children. * * @return names (name . ext) of subfiles */ protected final String[] list() { return getAbstractFileSystem().list.children(getPath()); }
/** * Tests if file really exists or is missing. Some operation on it may be restricted. * @return true indicates that the file is missing. * @since 1.9 */ public boolean isVirtual() { return getAbstractFileSystem().checkVirtual(getPath()); }
public long getSize() { return getAbstractFileSystem().info.size(getPath()); }
/** Tests the lock if it is valid, if not throws exception. * @param l lock to test */ private void testLock(FileLock l) throws IOException { if (lock == null) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_InvalidLock", l, getPath(), getAbstractFileSystem().getDisplayName(), lock)); } if (lock.get() != l) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_InvalidLock", l, getPath(), getAbstractFileSystem().getDisplayName(), lock.get())); } }
public boolean canWrite() { AbstractFileSystem fs = getAbstractFileSystem(); return fs.canWrite(getPath()); }
public boolean canRead() { AbstractFileSystem fs = getAbstractFileSystem(); return fs.canRead(getPath()); }
@Deprecated // have to override for compat public boolean isReadOnly() { AbstractFileSystem fs = getAbstractFileSystem(); return fs.isReadOnly() || fs.info.readOnly(getPath()); }
public synchronized FileLock lock() throws IOException { if (lock != null) { FileLock f = 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<FileLock>(l); // Thread.dumpStack (); // System.out.println ("Locking file: " + this); // NOI18N return l; }
@Override public String getMIMEType() { String retVal = getAbstractFileSystem().info.mimeType(getPath()); if (retVal == null) { retVal = super.getMIMEType(); } return retVal; }
public Date lastModified() { initLastModified(!getAbstractFileSystem().isLastModifiedCacheEnabled()); return getLastModified(); }
private boolean initLastModified(boolean force) { boolean retval = force || (getLastModified() == null); if (retval) { putLastModified(getAbstractFileSystem().info.lastModified(getPath())); } return retval; }
/** Unlocks the file. Notifies the underlaying impl. */ void unlock(FileLock fLock) { FileLock currentLock = null; synchronized(this) { if (lock != null) { currentLock = lock.get(); } if (currentLock == fLock) { putLastModified(null); // clear my lock lock = null; } } getAbstractFileSystem().info.unlock(getPath()); if (isValid()) { lastModified(); } }
/** fireFileChange defines if should be fired fileChanged event after close of stream*/ synchronized OutputStream getOutputStream(FileLock lock, boolean fireFileChanged) throws IOException { FileSystem fs = getAbstractFileSystem(); if (fs.isReadOnly()) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", fs.getDisplayName())); } if (isReadOnly()) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FisRO", name, fs.getDisplayName())); } testLock(lock); return StreamPool.createOutputStream(this, fireFileChanged); }
void setAttribute(String attrName, Object value, boolean fire) throws IOException { Object oldValue = null; //FileSystem fs = getAbstractFileSystem (); //if (fs.isReadOnly()) XMLFileSystemTestHid.java:934 // throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", fs.getDisplayName ()); // NOI18N if (fire) { oldValue = getAttribute(attrName); } getAbstractFileSystem().attr.writeAttribute(getPath(), attrName, value); if (fire && (oldValue != value) && hasAtLeastOneListeners()) { fileAttributeChanged0(new FileAttributeEvent(this, attrName, oldValue, value)); } }