ch.interlis.iom_j.itf
Class ItfWriter

java.lang.Object
  extended by ch.interlis.iom_j.itf.ItfWriter
All Implemented Interfaces:
IoxWriter

public class ItfWriter
extends java.lang.Object
implements IoxWriter

This class implements an INTERLIS 1 writer.

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

Constructor Summary
ItfWriter(java.io.File outFile, ch.interlis.ili2c.metamodel.TransferDescription td)
          Creates a new writer.
ItfWriter(java.io.OutputStream out, ch.interlis.ili2c.metamodel.TransferDescription td)
          Creates a new 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.
 void setFactory(IoxFactoryCollection factory)
          sets the factory collection to be used.
 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

ItfWriter

public ItfWriter(java.io.OutputStream out,
                 ch.interlis.ili2c.metamodel.TransferDescription td)
          throws IoxException
Creates a new writer.

Parameters:
out - Output stream to write to
td - model of data to write as read by the compiler
Throws:
IoxException

ItfWriter

public ItfWriter(java.io.File outFile,
                 ch.interlis.ili2c.metamodel.TransferDescription td)
          throws IoxException
Creates a new writer.

Parameters:
outFile - file to write to
td - model of data to write as read by the compiler
Throws:
IoxException
Method Detail

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

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

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