Package weka.core.xml
Class SerialUIDChanger
java.lang.Object
weka.core.xml.SerialUIDChanger
- All Implemented Interfaces:
- RevisionHandler
This class enables one to change the UID of a serialized object and therefore
 not losing the data stored in the binary format.
- Version:
- $Revision: 8034 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidbinaryToKOML(String binary, String koml) converts a binary file into a KOML XML filestatic voidchanges the oldUID into newUID from the given file (binary/KOML) into the other one (binary/KOML).Returns the revision string.static booleanchecks whether the given filename ends with ".koml"static voidkomlToBinary(String koml, String binary) converts a KOML file into a binary onestatic voidexchanges an old UID for a new one.
- 
Constructor Details- 
SerialUIDChangerpublic SerialUIDChanger()
 
- 
- 
Method Details- 
isKOMLchecks whether the given filename ends with ".koml"- Parameters:
- filename- the filename to check
- Returns:
- whether it is a KOML file or not
- See Also:
 
- 
binaryToKOMLconverts a binary file into a KOML XML file- Parameters:
- binary- the binary file to convert
- koml- where to store the XML output
- Throws:
- Exception- if conversion fails
 
- 
komlToBinaryconverts a KOML file into a binary one- Parameters:
- koml- the filename with the XML data
- binary- the name of the
- Throws:
- Exception
 
- 
changeUIDpublic static void changeUID(long oldUID, long newUID, String fromFile, String toFile) throws Exception changes the oldUID into newUID from the given file (binary/KOML) into the other one (binary/KOML). it basically does a replace in the XML, i.e. it looks for " uid='oldUID'" and replaces it with " uid='newUID'".- Parameters:
- oldUID- the old UID to change
- newUID- the new UID to use
- fromFile- the original file with the old UID
- toFile- the new file where to store the modified UID
- Throws:
- Exception- if conversion fails
 
- 
getRevisionReturns the revision string.- Specified by:
- getRevisionin interface- RevisionHandler
- Returns:
- the revision
 
- 
mainexchanges an old UID for a new one. a file that doesn't end with ".koml" is considered being binary. takes four arguments: oldUID newUID oldFilename newFilename- Parameters:
- args- the command line parameters
- Throws:
- Exception
- See Also:
 
 
-