public abstract static class DataEditorSupport.Env extends OpenSupport.Env implements CloneableEditorSupport.Env
PROP_TIMEPROP_MODIFIED, PROP_VALID| Constructor and Description |
|---|
Env(DataObject obj)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
changeFile()
Method that allows subclasses to notify this environment that
the file associated with this support has changed and that
the environment should listen on modifications of different
file object.
|
protected abstract FileObject |
getFile()
Getter for file associated with this environment.
|
String |
getMimeType()
Mime type of the document.
|
Date |
getTime()
The time when the data has been modified
|
InputStream |
inputStream()
Obtains the input stream.
|
void |
markModified()
First of all tries to lock the primary file and
if it succeeds it marks the data object modified.
|
OutputStream |
outputStream()
Obtains the output stream.
|
protected abstract FileLock |
takeLock()
Locks the file.
|
void |
unmarkModified()
Reverse method that can be called to make the environment
unmodified.
|
addPropertyChangeListener, addVetoableChangeListener, findCloneableOpenSupport, firePropertyChange, fireVetoableChange, getDataObject, isModified, isValid, propertyChange, removePropertyChangeListener, removeVetoableChangeListener, vetoableChangeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, addVetoableChangeListener, findCloneableOpenSupport, isModified, isValid, removePropertyChangeListener, removeVetoableChangeListenerpublic Env(DataObject obj)
obj - this support should be associated withprotected abstract FileObject getFile()
protected abstract FileLock takeLock() throws IOException
IOException - if the file cannot be lockedprotected final void changeFile()
public InputStream inputStream() throws IOException
inputStream in interface CloneableEditorSupport.EnvIOException - if an I/O error occurspublic OutputStream outputStream() throws IOException
outputStream in interface CloneableEditorSupport.EnvIOException - if an I/O error occurspublic Date getTime()
getTime in interface CloneableEditorSupport.Envpublic String getMimeType()
getMimeType in interface CloneableEditorSupport.Envpublic void markModified()
throws IOException
Note: There is a contract (better saying a curse)
that this method has to call takeLock() method
in order to keep working some special filesystem's feature.
See issue #28212.
markModified in interface CloneableOpenSupport.EnvmarkModified in class OpenSupport.EnvIOException - if the environment cannot be marked modified
(for example when the file is readonly), when such exception
is the support should discard all previous changesFileObject.isReadOnly()public void unmarkModified()
unmarkModified in interface CloneableOpenSupport.EnvunmarkModified in class OpenSupport.EnvBuilt on August 24 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.