edu.washington.biostr.sig.brainj3d.data.encoder
Class BasicXMLEncoder

java.lang.Object
  extended by edu.washington.biostr.sig.brainj3d.data.encoder.BasicXMLEncoder
All Implemented Interfaces:
Encoder
Direct Known Subclasses:
LibraryEncoder, TreeTemplateEncoder, XMapEncoder

public abstract class BasicXMLEncoder
extends Object
implements Encoder

Title:

Description:

Copyright: Copyright (c) 2003

Company:

This is a convenience encoder that will encode an XML Document. To use simply implement createDocument(). This assumes that we are dealing with a single file and won't work with multiple files.

Version:
1.0
Author:
not attributable

Constructor Summary
BasicXMLEncoder()
          Create a BasicXMLEncoder with the default extension of xml.
BasicXMLEncoder(String extension)
          Create a BasicXMLEncoder with the specified extension.
 
Method Summary
abstract  Document createDocument(Document document, String directory, String name, Data data)
          Create an XML document that will be encoded into a byte[].
 void encode(String directory, String name, Data data, OutputStream[] streams, Set<Tag> metadata)
          Create a byte[] that represents an XML document.
 String[] getExtensions()
           
 int getNumberOfFiles()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.washington.biostr.sig.brainj3d.data.Encoder
getEncodableData
 

Constructor Detail

BasicXMLEncoder

public BasicXMLEncoder()
Create a BasicXMLEncoder with the default extension of xml.


BasicXMLEncoder

public BasicXMLEncoder(String extension)
Create a BasicXMLEncoder with the specified extension.

Parameters:
extension -
Method Detail

encode

public void encode(String directory,
                   String name,
                   Data data,
                   OutputStream[] streams,
                   Set<Tag> metadata)
            throws IOException
Create a byte[] that represents an XML document. It gets the Document's Nodes from getDocument().

Specified by:
encode in interface Encoder
Parameters:
directory -
name -
data -
metadata - TODO
Throws:
IOException

createDocument

public abstract Document createDocument(Document document,
                                        String directory,
                                        String name,
                                        Data data)
Create an XML document that will be encoded into a byte[]. The returned document will be encoded, but to help out, a blank Document is provided. We do not assume that you use the provided document. Feel free to generate a new one.

Parameters:
document - A blank document to build off of.
directory - The directory in which the file will be saved in case is needed to encode information.
name - The filename to save the file as, in case it is needed to encode information.
data - The data to encode
Returns:
The document to save.

getNumberOfFiles

public final int getNumberOfFiles()
Specified by:
getNumberOfFiles in interface Encoder

getExtensions

public final String[] getExtensions()
Specified by:
getExtensions in interface Encoder


Copyright © 2006 University of Washington. All Rights Reserved.