public abstract static class DataEditorSupport.Env extends OpenSupport.Env implements CloneableEditorSupport.Env
PROP_TIME
PROP_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, toString, vetoableChange
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addVetoableChangeListener, findCloneableOpenSupport, isModified, isValid, removePropertyChangeListener, removeVetoableChangeListener
public 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.Env
IOException
- if an I/O error occurspublic OutputStream outputStream() throws IOException
outputStream
in interface CloneableEditorSupport.Env
IOException
- if an I/O error occurspublic Date getTime()
getTime
in interface CloneableEditorSupport.Env
public String getMimeType()
getMimeType
in interface CloneableEditorSupport.Env
public void markModified() throws IOException
Note: There is a contract (better saying a curse)
that this method has to call DataEditorSupport.Env.takeLock()
method
in order to keep working some special filesystem's feature.
See issue #28212.
markModified
in interface CloneableOpenSupport.Env
markModified
in class OpenSupport.Env
IOException
- 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.Env
unmarkModified
in class OpenSupport.Env