|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkirk.io.sdl.ESDLWriter
This class writes an ESDL description indicated by an SDLDocument
to
an OutputStream
, using UTF-16. This means that the class will lay out
the SDL data in a neatly ordened fashion. Currently no preference settings are
available.
To make things as easy as possible, all you have to do is:
ESDLWriter.writeESDL(<SDLDocument>, <OutputStream>);
(when writing to an OutputStream
)
or
ESDLWriter.writeESDLFile(<SDLDocument>, <filename>);
(when writing to a file).
This also means you cannot instantiate this class yourself. If for some reason you
need to do this, extend this class. The constructor is protected.
SDLDocument
Field Summary | |
protected int |
position
The position in the file. |
protected BufferedWriter |
writer
The Writer the SDL document is written to. |
Constructor Summary | |
protected |
ESDLWriter(OutputStream out)
Constructs a new ESDLWriter with the given output source to write
to. |
Method Summary | |
protected void |
close()
Closes the underlying stream. |
void |
finalize()
The finalize method. |
protected ESDLWriteException |
getException(String error)
Returns an ESDLWriteException with the given message, and some
other information, like the place it happened in the file. |
protected void |
write(String string)
Writes a string to the output stream. |
protected void |
writeDataElement(int indentation,
SDLDataElement element)
Writes the given SDLDataElement to the output stream. |
protected void |
writeElement(int indentation,
SDLElement element)
Writes the given SDLElement to the output stream. |
protected void |
writeEndTag(int indentation,
String tagname)
Writes the given tagname as end tag to the stream, with the given indentation, and a linebreak. |
static void |
writeESDL(SDLDocument document,
OutputStream out)
Writes the given SDLDocument to the given
OutputStream . |
static void |
writeESDLFile(SDLDocument document,
String filename)
Writes the given SDLDocument to file with the given filename. |
protected void |
writeFullTag(int indentation,
String name,
String value)
Writes a tag pair with the given tag name and tag value to the stream. |
protected void |
writeLine(int indentation,
String string,
boolean newline)
Writes a line to the output stream. |
protected void |
writeNewLine()
Writes a newline character to the stream. |
protected void |
writeNormalElement(int indentation,
SDLNormalElement element)
Writes the given SDLNormalElement to the output stream. |
protected void |
writeSDLDocument(SDLDocument document)
Writes the given SDLDocument to the output stream. |
protected void |
writeStartTag(int indentation,
String tagname,
boolean newline)
Writes the given tagname as start tag to the stream, with the given indentation, and a linebreak if requested. |
protected void |
writeTab()
Writes a tab character to the stream. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected BufferedWriter writer
Writer
the SDL document is written to.
protected int position
Constructor Detail |
protected ESDLWriter(OutputStream out) throws IOException
ESDLWriter
with the given output source to write
to. If you wish to write to a file for example, supply a
new FileOutputStream("filename")
. The output source will write
raw byte data to the stream using UTF-16 encoding.
out
- The OutputStream
to be written to.
IOException
- When an IO exception occurs. Mmmyeah.Method Detail |
protected void writeSDLDocument(SDLDocument document) throws IOException, ESDLWriteException
SDLDocument
to the output stream.
document
- The SDLDocument
to write.
IOException
- When IO errors occur.
ESDLWriteException
- When ESDL errors occur.protected void writeElement(int indentation, SDLElement element) throws IOException, ESDLWriteException
SDLElement
to the output stream.
indentation
- The amount of tabs used for indentation.element
- The SDLElement
to write.
IOException
- When IO errors occur.
ESDLWriteException
- When ESDL errors occur.protected void writeNormalElement(int indentation, SDLNormalElement element) throws IOException, ESDLWriteException
SDLNormalElement
to the output stream.
indentation
- The amount of tabs used for indentation.element
- The SDLNormalElement
to write.
IOException
- When IO errors occur.
ESDLWriteException
- When ESDL errors occur.protected void writeDataElement(int indentation, SDLDataElement element) throws IOException
SDLDataElement
to the output stream.
indentation
- The amount of tabs used for indentation.element
- The SDLDataElement
to write.
IOException
- When IO errors occur.protected void writeStartTag(int indentation, String tagname, boolean newline) throws IOException
indentation
- The amount of tabs before the start tag.tagname
- The name of the start tag to be written.
IOException
- When IO errors occur.protected void writeEndTag(int indentation, String tagname) throws IOException
indentation
- The amount of tabs before the end tag.tagname
- The name of the end tag to be written.
IOException
- When IO errors occur.protected void writeFullTag(int indentation, String name, String value) throws IOException
indentation
- The amount of tabs before the tag pair.name
- The name of the tag pair to be written.value
- The value of the tag pair to be written.
IOException
- When IO errors occur.protected void writeLine(int indentation, String string, boolean newline) throws IOException
string
- The String
to be written.
IOException
- When IO errors occur.protected void writeNewLine() throws IOException
IOException
- When IO errors occur.protected void writeTab() throws IOException
IOException
- When IO errors occur.protected void write(String string) throws IOException
string
- The String
to be written.
IOException
- When IO errors occur.protected ESDLWriteException getException(String error)
ESDLWriteException
with the given message, and some
other information, like the place it happened in the file.
error
- The error that occured.
ESDLWriteException
that signifies the given error.public void finalize()
Object.finalize()
protected void close() throws IOException
IOException
- When IO errors occur.public static void writeESDL(SDLDocument document, OutputStream out) throws IOException, ESDLWriteException
SDLDocument
to the given
OutputStream
.
document
- The SDLDocument
that should be written.out
- The OutputStream
that it should be written to.
IOException
- When IO errors occur.
ESDLWriteException
- When ESDL errors occur.public static void writeESDLFile(SDLDocument document, String filename) throws IOException, ESDLWriteException
SDLDocument
to file with the given filename.
document
- The SDLDocument
that should be written.filename
- The name of the file it should be written to.
IOException
- When IO errors occur.
ESDLWriteException
- When ESDL errors occur.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |