|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.exist.fluent.Resource
org.exist.fluent.NamedResource
org.exist.fluent.Document
public class Document
A document from the database, either binary or XML. Note that querying a non-XML document is harmless, but will never return any results.
| Nested Class Summary | |
|---|---|
static class |
Document.Event
An event that concerns a document. |
static interface |
Document.Listener
Listener for events affecting documents. |
class |
Document.ListenersFacet
The facet that gives access to a document's listeners. |
static class |
Document.MetadataFacet
The metadata facet for this document. |
| Method Summary | |
|---|---|
String |
contentsAsString()
Return the contents of this document interpreted as a string. |
Document |
copy(Folder destination,
Name name)
Copy this document to another collection, potentially changing the copy's name in the process. |
void |
delete()
Delete this document from the database. |
boolean |
equals(Object o)
|
void |
export(File destination)
Export this document to the given file, overwriting it if it already exists. |
Folder |
folder()
Return the folder that contains this document. |
int |
hashCode()
|
long |
length()
Return the length of this document, in bytes. |
Document.ListenersFacet |
listeners()
Return the listeners facet for this document, used for adding and removing document listeners. |
Document.MetadataFacet |
metadata()
Return the metadata facet for this resource, which lets you read and manipulate metadata such as ownership, access permissions, and creation/modification timestamps. |
void |
move(Folder destination,
Name name)
Move this document to another collection, potentially changing its name in the process. |
String |
name()
Return the local filename of this document. |
String |
path()
Return the full path of this document. |
String |
toString()
Return a string representation of the reference to this document. |
void |
write(OutputStream stream)
Copy the contents of the document to the given stream. |
XMLDocument |
xml()
Cast this document to an XMLDocument, if possible. |
| Methods inherited from class org.exist.fluent.Resource |
|---|
database, namespaceBindings, query |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Document.ListenersFacet listeners()
public Document.MetadataFacet metadata()
NamedResource
metadata in class NamedResourcepublic XMLDocument xml()
XMLDocument, if possible.
DatabaseException - if this document is not an XML documentpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic String name()
name in class NamedResourcepublic String path()
path in class NamedResourcepublic Folder folder()
public long length()
public void delete()
delete in class NamedResource
public Document copy(Folder destination,
Name name)
copy in class NamedResourcedestination - the destination folder for the copyname - the desired name for the copy
Name
public void move(Folder destination,
Name name)
doc.move(newFolder, Name.keepCreate())) or to rename a document
without changing its location (doc.move(doc.folder(), Name.create(newName))).
move in class NamedResourcedestination - the destination folder for the movename - the desired name for the moved documentNamepublic String contentsAsString()
DatabaseException - if the encoding is not supported or some other unexpected IOException occursDatabase.setDefaultCharacterEncoding(String)
public void export(File destination)
throws IOException
destination - the file to export to
IOException - if the export failed due to an I/O error
public void write(OutputStream stream)
throws IOException
stream - the output stream to copy the document to
IOException - in case of I/O problems;
WARNING: I/O exceptions are currently logged and eaten by eXist, so they won't propagate to this layer!Database.setDefaultCharacterEncoding(String)
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||