Package de.uni_trier.wi2.procake.utils.io
CAKE IO Description
CAKE provides a centralized concept for all IO operations. IO operations are for example XML parsers and writers or network protocols. The goal of the concept is to easily replace a XML parser or writer with another one or with another technologie. This should be possible without changing the code.
IO Factory
All io components to convert object to and from streams can be requested in the IOFactory
. The factory is a normal Factory
where several io components can be bind.
To way how to get a io component is always the same:
- request the io names that are able to handle a given class
- request the io component with one of the names
For example, to get an parser for a Model
the Java
code would
be:
String names[] = IOFactory.getReaderNamesFor(Model.class); if (names.length == 0) throw new CakeIOException(IO.COMPONENT, IO.LOG_READER_NOT_FOUND, this, Model.class); Reader reader = (Reader) IOFactory.newIO(names[0]); reader.setFilename("..."); Model model = (Model) reader.read();
One factory is available: IOFactory
Helper Classes
Beside the usage of the io components also some classes are provided that support the developer to write io components.
de.uni_trier.wi2.procake.utils.io.xerces
- Currently, all parser and writers in CAKE are using XML. To simplify the handling this packages provides a simplified parser and writer infrastructure.
-
Interface Summary Interface Description ContentHandler The ContentHandler extends theContentHandler
of the SAX parser API with an additional unified method to get the parsed object.IO The IO interace summarises constants and methods for all io components.LogComponentIdentifier Interface with constants required for the Logger.Reader The Reader interface provides some common constants and methods for all io readers.ResourcePaths Writer The Writer interface provides some common constants and methods for all io writers. -
Class Summary Class Description CakeCSVParser A CSV Parser, that uses the csv package from the Apache group.IOFactory IOUtil