Class CollabTextDocument
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Constructor Summary
ConstructorDescriptionCollabTextDocument
(InputStream inputStream) Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.CollabTextDocument
(InputStream inputStream, Map<Long, byte[]> resourceManager, Map<String, Object> configuration) Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.CollabTextDocument
(InputStream documentStream, Map<String, Object> configuration) Creates an CollabTextDocument from the OpenDocument provided by a resource Stream. -
Method Summary
Modifier and TypeMethodDescriptionint
applyChanges
(String operationString) Applies the (known) operations to upon the latest state of the ODF text documentint
applyChanges
(org.json.JSONObject operations) Applies the (known) operations to upon the latest state of the ODF text documentvoid
close()
Close the OdfPackage and release all temporary created data.int
long
Returns the OdfTextDocument encapsulating the DOM vieworg.json.JSONObject
Receives the (known) operations of the ODF text documentint
int
int
int
Returns the OdfPackageReceives the a map with new resources for the Documentstatic CollabTextDocument
Creates a new ODT document from the default template
-
Constructor Details
-
CollabTextDocument
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequential) read access needed by CollabTextDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
- Parameters:
inputStream
- - the InputStream of the ODF text document.- Throws:
Exception
-
CollabTextDocument
public CollabTextDocument(InputStream documentStream, Map<String, Object> configuration) throws ExceptionCreates an CollabTextDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequential) read access needed by CollabTextDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
- Parameters:
configuration
- - key/value pairs of user given run-time settings (configuration)documentStream
- - the InputStream of the ODF text document.- Throws:
Exception
-
CollabTextDocument
public CollabTextDocument(InputStream inputStream, Map<Long, byte[]> resourceManager, Map<String, throws ExceptionObject> configuration) Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequential) read access needed by CollabTextDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
- Parameters:
inputStream
- - the InputStream of the ODF text document.resourceManager
- - the bytes of new resources can be accessed by an ID.configuration
- - key/value pairs of user given run-time settings (configuration)- Throws:
Exception
- document could not be opened
-
-
Method Details
-
getOwnerDocument
- Throws:
SAXException
IOException
-
newTextCollabDocument
Creates a new ODT document from the default template- Returns:
- new CollabTextDocument
- Throws:
Exception
-
getDocumentAsChanges
public org.json.JSONObject getDocumentAsChanges() throws SAXException, org.json.JSONException, IOExceptionReceives the (known) operations of the ODF text document- Returns:
- the operations as JSON
- Throws:
SAXException
org.json.JSONException
IOException
-
applyChanges
Applies the (known) operations to upon the latest state of the ODF text document- Parameters:
operationString
- ODF operations as String JSONObject with "changes" as key for operations- Returns:
- the number of operations being accepted
- Throws:
Exception
-
applyChanges
Applies the (known) operations to upon the latest state of the ODF text document- Parameters:
operations
- ODF operations as JSONArray within an JSONObject with OPK_OPERATIONS key fromOperationConstants
.- Returns:
- the number of operations being accepted
- Throws:
Exception
-
getContentSize
public long getContentSize() -
getDocument
Returns the OdfTextDocument encapsulating the DOM view- Returns:
- ODF document - currently only Te
-
getPackage
Returns the OdfPackage- Returns:
- ODF Package
-
close
public void close()Close the OdfPackage and release all temporary created data. After execution of this method, this class is no longer usable. Do this as the last action to free resources. Closing an already closed document has no effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
countAppliedChanges
public int countAppliedChanges()- Returns:
- number of correct applied operations
-
getMaxTableColumnsCount
public int getMaxTableColumnsCount() -
getMaxTableRowsCount
public int getMaxTableRowsCount() -
getMaxTableCellCount
public int getMaxTableCellCount() -
getMaxSheetCount
public int getMaxSheetCount() -
getResourceMap
Receives the a map with new resources for the Document- Returns:
- the operations as JSON
-