Package gov.nih.mipav.model.file
Class FileXML
- java.lang.Object
-
- gov.nih.mipav.model.file.FileBase
-
- gov.nih.mipav.model.file.FileXML
-
- Direct Known Subclasses:
FileDataProvenance
,FileImageXML
,FilePolylineVOIXML
,FileSurfaceGiftiXML
,FileSurfaceRefXML
,FileSurfaceVTKXML
,FileSurfaceXML
,FileVOI
public abstract class FileXML extends FileBase
Abstract base class for reading/writing .XML file headers. The XML reader uses any schema (.XSD) file, pased into the readHeader function, for parsing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
FileXML.XMLAttributes
Class used to store an xml tag's attribute (name and value)
-
Field Summary
Fields Modifier and Type Field Description protected java.io.BufferedWriter
bw
Buffered writer for writing to XML fileprotected java.lang.String
fileDir
Directory of XML file on disk.protected FileInfoXML
fileInfo
the file info storing xml specific information, abstract base class of FileInfoImageXML or FileInfoSurfaceXML:protected java.lang.String
fileName
Name of the XML header file on disk.protected org.xml.sax.helpers.DefaultHandler
m_kHandler
DOCUMENT ME!protected static java.lang.String
MIPAV_HEADER
Mipav header string (for top of xml header).protected ProgressBarInterface
pInterface
progress bar implementation (either through a JProgressBar or JPanel) passed in for reading/saving file.protected static java.lang.String
TAB
TAB string.protected int
tabLevel
tab level counter for writing xml header.protected static java.lang.String
W3C_XML_SCHEMA
XML schema string.protected static java.lang.String
XML_ENCODING
XML encoding string.protected static java.lang.String
XML_HEADER
XML header string.-
Fields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE
-
-
Constructor Summary
Constructors Constructor Description FileXML(java.lang.String fName, java.lang.String fDir)
Constructs new file object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closedTag(java.lang.String tag, java.lang.String val)
Simple function to write an xml formatted closed tag including the tag value.void
closedTag(java.lang.String tag, java.lang.String val, java.util.Vector<FileXML.XMLAttributes> attr)
Writes a closed tag (tag, end tag) with the addition of attributes (name="value") from within a Vector (can do any number of XMLAttributes ...class included below)void
closedTag(java.lang.String tag, java.util.Vector<FileXML.XMLAttributes> attr)
Writes a closed tag where no value is specified, only attributes.void
finalize()
Prepares class for cleanup.void
openTag(java.lang.String tag, boolean start)
Simple function to write an xml formatted open ended tag (value not included).FileInfoXML
readHeader(java.lang.String headerFileName, java.lang.String headerDir, java.lang.String kFileXSD)
readHeader parses the input XML file based on the input XSD file, kFileXSD:void
setPBar(ProgressBarInterface pBar)
Sets the progress bar to be used for loading/saving image (JProgressBar or JPanel).-
Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, floatToBytes, getBufferDouble, getBufferFloat, getBufferInt, getBufferLong, getBufferShort, getBufferUShort, getDataType, getDouble, getFloat, getInt, getLong, getProgressChangeListeners, getRaFile, getSignedShort, getString, getUInt, getUnsignedByte, getUnsignedShort, intToBytes, isBigEndian, isProgressBarVisible, linkProgress, longToBytes, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, removeProgressChangeListener, setBigEndian, setBufferFloat, setBufferInt, setBufferLong, setBufferShort, setBufferString, setDataType, setEndianess, shortToBytes, writeBytes, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
-
-
-
Field Detail
-
TAB
protected static final java.lang.String TAB
TAB string.- See Also:
- Constant Field Values
-
W3C_XML_SCHEMA
protected static final java.lang.String W3C_XML_SCHEMA
XML schema string.- See Also:
- Constant Field Values
-
XML_ENCODING
protected static final java.lang.String XML_ENCODING
XML encoding string.- See Also:
- Constant Field Values
-
XML_HEADER
protected static final java.lang.String XML_HEADER
XML header string.- See Also:
- Constant Field Values
-
MIPAV_HEADER
protected static final java.lang.String MIPAV_HEADER
Mipav header string (for top of xml header).- See Also:
- Constant Field Values
-
fileDir
protected java.lang.String fileDir
Directory of XML file on disk.
-
fileInfo
protected FileInfoXML fileInfo
the file info storing xml specific information, abstract base class of FileInfoImageXML or FileInfoSurfaceXML:
-
fileName
protected java.lang.String fileName
Name of the XML header file on disk.
-
m_kHandler
protected org.xml.sax.helpers.DefaultHandler m_kHandler
DOCUMENT ME!
-
pInterface
protected ProgressBarInterface pInterface
progress bar implementation (either through a JProgressBar or JPanel) passed in for reading/saving file.
-
tabLevel
protected int tabLevel
tab level counter for writing xml header.
-
bw
protected java.io.BufferedWriter bw
Buffered writer for writing to XML file
-
-
Method Detail
-
openTag
public final void openTag(java.lang.String tag, boolean start)
Simple function to write an xml formatted open ended tag (value not included).- Parameters:
bw
- writer to usetag
- tag namestart
- is this a start or end tag
-
readHeader
public FileInfoXML readHeader(java.lang.String headerFileName, java.lang.String headerDir, java.lang.String kFileXSD)
readHeader parses the input XML file based on the input XSD file, kFileXSD:- Parameters:
headerFileName
- DOCUMENT ME!headerDir
- DOCUMENT ME!kFileXSD
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
setPBar
public void setPBar(ProgressBarInterface pBar)
Sets the progress bar to be used for loading/saving image (JProgressBar or JPanel).- Parameters:
pBar
- ProgressBarInterface
-
closedTag
protected final void closedTag(java.lang.String tag, java.lang.String val)
Simple function to write an xml formatted closed tag including the tag value.- Parameters:
bw
- write to usetag
- tag nameval
- tag value
-
closedTag
public final void closedTag(java.lang.String tag, java.lang.String val, java.util.Vector<FileXML.XMLAttributes> attr)
Writes a closed tag (tag, end tag) with the addition of attributes (name="value") from within a Vector (can do any number of XMLAttributes ...class included below)- Parameters:
tag
- the tag nameval
- the tag's valueattr
- vector of XMLAttributes
-
closedTag
public final void closedTag(java.lang.String tag, java.util.Vector<FileXML.XMLAttributes> attr)
Writes a closed tag where no value is specified, only attributes.
-
-