|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.sourceforge.esw.collection.ATransducerAdapter
|
+--net.sourceforge.esw.collection.FileTransducerAdapter
Provides file based access to ITransducer implementors.
Performs Transduction between a specific data source and an
IMetaCollection instance.
This transduction occurs both ways; put() takes data
from the IMetaCollection instance to which this
ITransducer instance is attached and places it into the data
source represented by this ITransducer instance. The
get() method takes data from the data source represented by this
ITransducer instance and places it into the
IMetaCollection instance to which this ITransducer
instance is attached.
This FileTransducerAdapter instance provides get
and set methods for the file name. It also delegates all
get and put method invocations to the contained
IIOTransducer instance.
Example:
IMetaCollection meta = MetaFactory.createMetaCollection();
IIOTransducer transducer = createIOTransducer() // for whatever
// IIOTransducer instance
// you need to use.
FileTransducerAdapter adapter = new FileTransducerAdapter( "filename.txt",
transducer );
meta.setTransducer( adapter ); // Notice: set the adapter on the
// IMetaCollection instance
try {
meta.get();
}
catch ( TransducerException te ) {
te.printStackTrace(); // in case something went wrong.
}
| Field Summary | |
protected java.lang.String |
filename
Name of the file represented by this FileTransducerAdapter
instance. |
| Fields inherited from class net.sourceforge.esw.collection.ATransducerAdapter |
ioTransducer |
| Constructor Summary | |
FileTransducerAdapter()
Creates a new FileTransducerAdapter instance. |
|
FileTransducerAdapter(IIOTransducer aIIOTransducer)
Creates a new FileTransducerAdapter instance, delegating all
get and put method invocations to the specified
IIOTransducer instance. |
|
FileTransducerAdapter(java.lang.String aFilename)
Creates a new FileTransducerAdapter instance using the
specified file name. |
|
FileTransducerAdapter(java.lang.String aFilename,
IIOTransducer aIIOTransducer)
Creates a new FileTransducerAdapter instance with the
specified filename, delegating all get and put
method invocations to the specified IIOTransducer instance. |
|
| Method Summary | |
void |
get(IMetaCollection aCollection)
Gets the data source's data represented by this ITransducer
instance into the referenced IMetaCollection instance. |
java.lang.String |
getFilename()
Returns the name of the file for this FileTransducerAdapter
instance. |
void |
put(IMetaCollection aCollection)
Puts the referenced IMetaCollection instance's data into the
data source represented by this ITransducer instance. |
void |
setFilename(java.lang.String aFileName)
Sets the name of the file for this FileTransducerAdapter
instance. |
| Methods inherited from class net.sourceforge.esw.collection.ATransducerAdapter |
getContextFactory, getIOTranducer, setContextFactory, setIOTransducer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String filename
FileTransducerAdapter
instance.| Constructor Detail |
public FileTransducerAdapter()
FileTransducerAdapter instance.public FileTransducerAdapter(java.lang.String aFilename)
FileTransducerAdapter instance using the
specified file name.aFilename - the name of the file for this
FileTransducerAdapter instance.public FileTransducerAdapter(IIOTransducer aIIOTransducer)
FileTransducerAdapter instance, delegating all
get and put method invocations to the specified
IIOTransducer instance.aIIOTransducer - the IIOTransducer instance to which to
delegate.
public FileTransducerAdapter(java.lang.String aFilename,
IIOTransducer aIIOTransducer)
FileTransducerAdapter instance with the
specified filename, delegating all get and put
method invocations to the specified IIOTransducer instance.aFilename - the name of the file for this
FileTransducerAdapter instance.aIIOTransducer - the IIOTransducer instance to which to
delegate.| Method Detail |
public void setFilename(java.lang.String aFileName)
FileTransducerAdapter
instance.aFileName - the name of the file for this
FileTransducerAdapter instance.getFilename()public java.lang.String getFilename()
FileTransducerAdapter
instance.setFilename( String )
public void get(IMetaCollection aCollection)
throws TransducerException
ITransducer
instance into the referenced IMetaCollection instance.
This implementation creates a Reader instance on the file
specified by the previously specified filename and sets the
Reader instance on the previously specified
IIOTransducer instance, then calls get on the
IIOTransducer instance.
get in class ATransducerAdapteraCollection - the IMetaCollection instance into which to
read.TransducerException - if an error occurs during transduction.put( IMetaCollection )
public void put(IMetaCollection aCollection)
throws TransducerException
IMetaCollection instance's data into the
data source represented by this ITransducer instance.
This implementation creates a Writer instance on the file
specified by the previously specified filename and sets the
Writer instance on the previously specified
IIOTransducer instance, then calls get on the
IIOTransducer instance.
put in class ATransducerAdapteraCollection - the IMetaCollection instance from which to
take data.TransducerException - if an error occurs during transduction.get( IMetaCollection )
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||