|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectkirk.io.sdl.SDLWriter
This class writes an SDL description indicated by an SDLDocument
to an OutputStream, using UTF-16. To make things as easy as possible,
all you have to do is:
SDLWriter.writeSDL(<SDLDocument>, <OutputStream>);
(when writing to an OutputStream)
or
SDLWriter.writeSDLFile(<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 |
SDLWriter(OutputStream out)
Constructs a new SDLWriter with the given output source to write
to. |
| Method Summary | |
protected void |
close()
Closes the underlying stream. |
void |
finalize()
The finalize method. |
protected SDLWriteException |
getException(String error)
Returns an SDLWriteException 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(SDLDataElement element)
Writes the given SDLDataElement to the output stream. |
protected void |
writeElement(SDLElement element)
Writes the given SDLElement to the output stream. |
protected void |
writeEndTag(String tagname)
Writes the given tagname as end tag to the stream. |
protected void |
writeFullTag(String name,
String value)
Writes a tag pair with the given tag name and tag value to the stream. |
protected void |
writeNormalElement(SDLNormalElement element)
Writes the given SDLNormalElement to the output stream. |
static void |
writeSDL(SDLDocument document,
OutputStream out)
Writes the given SDLDocument to the given
OutputStream. |
protected void |
writeSDLDocument(SDLDocument document)
Writes the given SDLDocument to the output stream. |
static void |
writeSDLFile(SDLDocument document,
String filename)
Writes the given SDLDocument to file with the given filename. |
protected void |
writeStartTag(String tagname)
Writes the given tagname as start tag 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 SDLWriter(OutputStream out)
throws IOException
SDLWriter 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,
SDLWriteException
SDLDocument to the output stream.
document - The SDLDocument to write.
IOException - When IO errors occur.
SDLWriteException - When SDL errors occur.
protected void writeElement(SDLElement element)
throws IOException,
SDLWriteException
SDLElement to the output stream.
element - The SDLElement to write.
IOException - When IO errors occur.
SDLWriteException - When SDL errors occur.
protected void writeNormalElement(SDLNormalElement element)
throws IOException,
SDLWriteException
SDLNormalElement to the output stream.
element - The SDLNormalElement to write.
IOException - When IO errors occur.
SDLWriteException - When SDL errors occur.
protected void writeDataElement(SDLDataElement element)
throws IOException
SDLDataElement to the output stream.
element - The SDLDataElement to write.
IOException - When IO errors occur.
protected void writeStartTag(String tagname)
throws IOException
tagname - The name of the start tag to be written.
IOException - When IO errors occur.
protected void writeEndTag(String tagname)
throws IOException
tagname - The name of the end tag to be written.
IOException - When IO errors occur.
protected void writeFullTag(String name,
String value)
throws IOException
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 write(String string)
throws IOException
string - The String to be written.
IOException - When IO errors occur.protected SDLWriteException getException(String error)
SDLWriteException with the given message, and some
other information, like the place it happened in the file.
error - The error that occured.
SDLWriteException that signifies the given error.public void finalize()
Object.finalize()
protected void close()
throws IOException
IOException - When IO errors occur.
public static void writeSDL(SDLDocument document,
OutputStream out)
throws IOException,
SDLWriteException
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.
SDLWriteException - When SDL errors occur.
public static void writeSDLFile(SDLDocument document,
String filename)
throws IOException,
SDLWriteException
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.
SDLWriteException - When SDL errors occur.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||