|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.chaosserver.bilbo.data.DataReaderWriter
Responsible for persistence of the Directory structure to/from an Xml mapping file.
Field Summary | |
static String |
DIRECTORY_NAME_ATT
Xml tag for the directory name. |
static String |
DIRECTORY_TAG
Xml tag for the Directory object. |
protected Document |
document
Holds teh document being constructed for writing. |
protected String |
encoding
Indicates type of encoding to try. |
static String |
FILE_TAG
Xml tag for the FileMapping object. |
static String |
NAME_TAG
Xml tag for the Name object. |
static String |
STYLE_ATT
Xml attribute for the style property of the name attribute. |
Constructor Summary | |
DataReaderWriter()
Default constructor. |
|
DataReaderWriter(String encoding)
Creates a new DataReaderWriter object with the given character encoding. |
Method Summary | |
protected void |
addDirectory(Node node,
Directory directory)
Generates a new node for the DirectoryMapping and appends it to the node passed in. |
protected void |
addFilenameMapping(Node node,
FilenameMapping filenameMapping)
Generates a new node for the FilenameMapping and appends it the node passed in. |
protected void |
addName(Node node,
Name name)
Generates a new node the Name and appends it to the node passed in. |
Directory |
read(Reader reader)
Reads in a Xml version of a directory and demarshalls it into the object. |
void |
write(Writer writer,
Directory directory)
Writes the Directory object as Xml to the given writier. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DIRECTORY_TAG
public static final String DIRECTORY_NAME_ATT
public static final String FILE_TAG
public static final String NAME_TAG
public static final String STYLE_ATT
protected String encoding
protected Document document
Constructor Detail |
public DataReaderWriter()
public DataReaderWriter(String encoding)
encoding
- the encoding to use when reading/writing.Method Detail |
public void write(Writer writer, Directory directory) throws ReaderWriterException
writer
- the writer to put the xml output intodirectory
- the directory to convert to xml and write
ReaderWriterException
- if there is an errorprotected void addDirectory(Node node, Directory directory) throws ReaderWriterException
node
- the note to append todirectory
- the directory to append
ReaderWriterException
- if something goes wrongprotected void addFilenameMapping(Node node, FilenameMapping filenameMapping) throws ReaderWriterException
node
- the node to append tofilenameMapping
- the filenameMapping to convert to a node
ReaderWriterException
- if something goes wrongprotected void addName(Node node, Name name) throws ReaderWriterException
node
- the node to append toname
- the name to convert to a node
ReaderWriterException
- generic exception that there was an error
adding the namepublic Directory read(Reader reader) throws ReaderWriterException
reader
- the reader that the Xml comes from
ReaderWriterException
- if something goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |