ch.interlis.iom_j.xtf
Class XtfWriterBase

java.lang.Object
  extended by ch.interlis.iom_j.xtf.XtfWriterBase
All Implemented Interfaces:
IoxWriter
Direct Known Subclasses:
XtfWriter

public class XtfWriterBase
extends java.lang.Object
implements IoxWriter

This class implements an INTERLIS 2 writer using a lightweight model representation.

Version:
$Revision: 1.0 $ $Date: 24.07.2006 $
Author:
ce

Constructor Summary
XtfWriterBase(java.io.File outfile, ViewableProperties mapping1, java.lang.String version)
          Creates a new instance of a writer.
XtfWriterBase(java.io.OutputStream buffer, ViewableProperties mapping1, java.lang.String version)
          Creates a new instance of a writer.
XtfWriterBase(java.io.OutputStreamWriter buffer, ViewableProperties mapping1, java.lang.String version)
          Creates a new instance of a writer.
 
Method Summary
 void close()
          Frees any resources associated with this Writer.
 IomObject createIomObject(java.lang.String type, java.lang.String oid)
          creates a IomObject with the given type and oid.
 void flush()
          Writes any cached events to the underlying output mechanism.
 IoxFactoryCollection getFactory()
          gets the current factory collection.
 XtfModel[] getModels()
          Gets the model descriptions.
 void setFactory(IoxFactoryCollection factory)
          sets the factory collection to be used.
 void setModels(XtfModel[] models)
          Sets the model descriptions.
 void write(IoxEvent event)
          writes the next event to this writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XtfWriterBase

public XtfWriterBase(java.io.OutputStreamWriter buffer,
                     ViewableProperties mapping1,
                     java.lang.String version)
              throws IoxException
Creates a new instance of a writer.

Parameters:
buffer - Output writer to write to
mapping1 - model of data to write
version - version of transfer format (2.2 or 2.3)
Throws:
IoxException

XtfWriterBase

public XtfWriterBase(java.io.File outfile,
                     ViewableProperties mapping1,
                     java.lang.String version)
              throws IoxException
Creates a new instance of a writer.

Parameters:
outfile - File to write to
mapping1 - model of data to write
version - version of transfer format (2.2 or 2.3)
Throws:
IoxException

XtfWriterBase

public XtfWriterBase(java.io.OutputStream buffer,
                     ViewableProperties mapping1,
                     java.lang.String version)
              throws IoxException
Creates a new instance of a writer.

Parameters:
buffer - Output stream to write to
mapping1 - model of data to write
version - version of transfer format (2.2 or 2.3)
Throws:
IoxException
Method Detail

write

public void write(IoxEvent event)
           throws IoxException
Description copied from interface: IoxWriter
writes the next event to this writer. The flow of events that a writer expects, is
StartTransferEvent {StartBasketEvent {ObjectEvent} EndBasketEvent} EndTransferEvent

Specified by:
write in interface IoxWriter
Throws:
IoxException

close

public void close()
           throws IoxException
Description copied from interface: IoxWriter
Frees any resources associated with this Writer. This method closes the underlying output stream only, if it was opened by this writer.

Specified by:
close in interface IoxWriter
Throws:
IoxException

flush

public void flush()
           throws IoxException
Description copied from interface: IoxWriter
Writes any cached events to the underlying output mechanism.

Specified by:
flush in interface IoxWriter
Throws:
IoxException

createIomObject

public IomObject createIomObject(java.lang.String type,
                                 java.lang.String oid)
                          throws IoxException
Description copied from interface: IoxWriter
creates a IomObject with the given type and oid.

Specified by:
createIomObject in interface IoxWriter
Parameters:
type - of object to create
oid - may be null
Returns:
null if factory don know how to create object for given type.
Throws:
IoxException

getFactory

public IoxFactoryCollection getFactory()
                                throws IoxException
Description copied from interface: IoxWriter
gets the current factory collection.

Specified by:
getFactory in interface IoxWriter
Throws:
IoxException

setFactory

public void setFactory(IoxFactoryCollection factory)
                throws IoxException
Description copied from interface: IoxWriter
sets the factory collection to be used. An implementation should intantiate with a default factory collection and not require a call to this function.

Specified by:
setFactory in interface IoxWriter
Throws:
IoxException

getModels

public XtfModel[] getModels()
Gets the model descriptions.


setModels

public void setModels(XtfModel[] models)
Sets the model descriptions.