|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.document.LiteXMLElement
net.jxta.impl.document.LiteXMLDocument
public class LiteXMLDocument
This class is an implementation of the StructuredDocument interface using a simplified XML implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.jxta.impl.document.LiteXMLElement |
---|
LiteXMLElement.charRange, LiteXMLElement.tagRange |
Field Summary | |
---|---|
(package private) StringBuilder |
docContent
The actual document contents. |
static StructuredDocumentFactory.TextInstantiator |
INSTANTIATOR
The instantiator for instances of our documents. |
Fields inherited from class net.jxta.impl.document.LiteXMLElement |
---|
doc, loc, paranoidConsistencyChecking, parent |
Constructor Summary | |
---|---|
LiteXMLDocument(MimeMediaType mimeType,
InputStream in)
Creates new LiteXMLDocument |
|
LiteXMLDocument(MimeMediaType mimeType,
Reader in)
Creates new LiteXMLDocument |
|
LiteXMLDocument(MimeMediaType mimeType,
String type)
Creates new LiteXMLDocument |
|
LiteXMLDocument(MimeMediaType mimeType,
String type,
String textValue)
Creates new LiteXMLDocument with a textValue in the root element |
Method Summary | |
---|---|
protected LiteXMLElement |
createElement(LiteXMLElement.tagRange loc)
Create a new text element as a sub-range of this document. |
LiteXMLElement |
createElement(Object key)
Create a new element without value. |
LiteXMLElement |
createElement(Object key,
Object val)
Create a new element with value. |
LiteXMLElement |
createElement(String name)
Create a new element without value. |
LiteXMLElement |
createElement(String name,
String val)
Create a new element with value. |
protected LiteXMLElement.tagRange |
getDocType(StringBuilder source,
boolean wholeElement)
|
(package private) LiteXMLDocument |
getDocument()
The document we are a part of. |
String |
getFileExtension()
Returns the file extension type used by this Document . |
MimeMediaType |
getMimeType()
Returns the MIME Media type of this Document per
IETF RFC 2046 MIME : Media Types. |
Reader |
getReader()
Returns the sequence of characters which represents the content of the TextDocument . |
LiteXMLDocument |
getRoot()
Get the root document element of the hierarchy this element belongs to. |
InputStream |
getStream()
Returns the stream of bytes which represents the content of this Document . |
protected void |
init(Reader in)
Initialises LiteXMLDocument. |
void |
sendToStream(OutputStream stream)
Send the contents of this Document to the specified stream. |
void |
sendToWriter(Writer writer)
Send the contents of this TextDocument to the specified
Writer. |
String |
toString()
A toString implementation for debugging purposes. |
Methods inherited from class net.jxta.impl.document.LiteXMLElement |
---|
addAttribute, addAttribute, addChildTags, adjustLocations, appendChild, checkConsistency, decodeEscaped, encodeEscaped, equals, getAttribute, getAttributeLoc, getAttributes, getChildren, getChildren, getChildren, getKey, getName, getParent, getTagRanges, getTextValue, getTextValue, getValue, printNice |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.jxta.document.Attributable |
---|
addAttribute, addAttribute, getAttribute, getAttributes |
Methods inherited from interface net.jxta.document.TextElement |
---|
getChildren, getKey, getName, getTextValue, getValue |
Methods inherited from interface net.jxta.document.Element |
---|
appendChild, getChildren, getChildren, getParent |
Field Detail |
---|
public static final StructuredDocumentFactory.TextInstantiator INSTANTIATOR
final StringBuilder docContent
Constructor Detail |
---|
LiteXMLDocument(MimeMediaType mimeType, String type)
LiteXMLDocument(MimeMediaType mimeType, String type, String textValue)
LiteXMLDocument(MimeMediaType mimeType, InputStream in) throws IOException
IOException
LiteXMLDocument(MimeMediaType mimeType, Reader in) throws IOException
IOException
Method Detail |
---|
public String toString()
toString
in class LiteXMLElement
public MimeMediaType getMimeType()
Document
per
IETF RFC 2046 MIME : Media Types.
JXTA does not currently support the 'Multipart
' or
'Message
' media types.
getMimeType
in interface Document
Document
.public String getFileExtension()
Document
. This
value is usually chosen based upon the MIME Media Type.
getFileExtension
in interface Document
Document
.public LiteXMLElement createElement(Object key)
createElement
in interface StructuredDocument<LiteXMLElement>
key
- The key of the element to be created.
public LiteXMLElement createElement(Object key, Object val)
createElement
in interface StructuredDocument<LiteXMLElement>
key
- The name of the element to be created.val
- The value of the element to be created or
null
if no value is desired.
public LiteXMLElement createElement(String name)
createElement
in interface StructuredTextDocument<LiteXMLElement>
createElement
in interface XMLDocument<LiteXMLElement>
name
- The name of the element to be created.
public LiteXMLElement createElement(String name, String val)
createElement
in interface StructuredTextDocument<LiteXMLElement>
createElement
in interface XMLDocument<LiteXMLElement>
name
- The name of the element to be created.val
- The value of the element to be created.
protected LiteXMLElement createElement(LiteXMLElement.tagRange loc)
loc
- The document range for the new element.
public Reader getReader()
TextDocument
.
getReader
in interface TextDocumentReaderIO
Reader
containing the characters of the
TextDocument
.public LiteXMLDocument getRoot()
getRoot
in interface Element<LiteXMLElement>
getRoot
in interface TextElement<LiteXMLElement>
getRoot
in interface XMLElement<LiteXMLElement>
getRoot
in class LiteXMLElement
public InputStream getStream() throws IOException
Document
.
getStream
in interface DocumentStreamIO
InputStream
containing the bytes
of this Document
.
IOException
- For errors while writing the Document
.public void sendToWriter(Writer writer) throws IOException
TextDocument
to the specified
Writer.
sendToWriter
in interface TextDocumentReaderIO
writer
- The Writer
to which the characters of the
TextDocument
will be written.
IOException
- If an I/O error occurs.public void sendToStream(OutputStream stream) throws IOException
Document
to the specified stream.
sendToStream
in interface DocumentStreamIO
stream
- The OutputStream to which the Document
will
be written.
IOException
- For errors while writing the Document
.protected void init(Reader in) throws IOException
IOException
protected LiteXMLElement.tagRange getDocType(StringBuilder source, boolean wholeElement)
LiteXMLDocument getDocument()
getDocument
in class LiteXMLElement
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |