public class Document
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected boolean |
swigCMemOwn |
Modifier | Constructor and Description |
---|---|
|
Document() |
|
Document(Document document) |
protected |
Document(long cPtr,
boolean cMemoryOwn) |
Modifier and Type | Method and Description |
---|---|
Chunk |
addChunk()
Add a new empty chunk to the document.
|
void |
append(Document document,
Progress progress)
Append chunks from another document.
|
void |
clear()
Remove all chunks from the project.
|
void |
close() |
void |
delete() |
java.lang.String |
dump()
Return document contents in XML format.
|
protected void |
finalize() |
java.util.Optional<Chunk> |
getActiveChunk()
Active chunk, may be null.
|
java.util.Optional<Chunk> |
getChunk(int key)
Chunk with specified key, may be null.
|
int[] |
getChunkKeys()
List of chunk keys in the document.
|
Chunk[] |
getChunks() |
protected static long |
getCPtr(Document obj) |
java.util.Map<java.lang.String,java.lang.String> |
getMeta()
Get project meta data
|
java.lang.String |
getPath() |
boolean |
isReadOnly()
Read only status.
|
void |
load(java.lang.String text)
Initialize document contents from XML format.
|
void |
open(java.lang.String path,
boolean read_only,
Progress progress)
Open project.
|
void |
remove(Chunk chunk)
Remove chunk from the project.
|
void |
save(java.lang.String path,
int[] chunk_keys,
Progress progress)
Save some chunks from the project.
|
void |
save(java.lang.String path,
Progress progress)
Save project.
|
void |
setActiveChunk(Chunk chunk)
Active chunk.
|
void |
setMeta(java.util.Map<java.lang.String,java.lang.String> meta)
Set project meta data.
|
void |
setReadOnly(boolean read_only)
Read only status.
|
protected Document(long cPtr, boolean cMemoryOwn)
public Document()
public Document(Document document)
protected static long getCPtr(Document obj)
protected void finalize()
finalize
in class java.lang.Object
public void delete()
public void close()
close
in interface java.lang.AutoCloseable
public java.lang.String dump()
public void load(java.lang.String text)
public void clear()
public void save(java.lang.String path, Progress progress)
path
- Path to the file.progress
- Progress callback.public void save(java.lang.String path, int[] chunk_keys, Progress progress)
path
- Path to the file.chunk_keys
- List of chunks to be saved.progress
- Progress callback.public void open(java.lang.String path, boolean read_only, Progress progress)
path
- Path to the file.read_only
- Open document in read-only mode.progress
- Progress callback.public java.lang.String getPath()
public void setReadOnly(boolean read_only)
public boolean isReadOnly()
public Chunk addChunk()
public Chunk[] getChunks()
public int[] getChunkKeys()
public java.util.Optional<Chunk> getChunk(int key)
public java.util.Optional<Chunk> getActiveChunk()
public void setActiveChunk(Chunk chunk)
public void remove(Chunk chunk)
chunk
- Chunk to remove.public void append(Document document, Progress progress)
document
- Document to append.public void setMeta(java.util.Map<java.lang.String,java.lang.String> meta)
public java.util.Map<java.lang.String,java.lang.String> getMeta()