|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectace.xmlparsers.ParseACEZipFile
public class ParseACEZipFile
Contains methods to zip and unzip the componant XML files of an ACE project.
This class uses the java.util.zip package to compress and decompress the componant files of an ACE project. A special file called project.sp is used internally to specify the path to the ACE XML project file and both are included in the zip file. The ACE XML project file will specify the pathnames to the ACE XML files that were compressed in the zip file. It is with the ACE XML project file that one is able to associate the different files of the extracted zip file with the different types of ACE datatypes/XML files (Taxonomy, Feature Key, Feature vectors, and etc). This ACE XML project file will be written automatically if one was not written already.
Constructor Summary | |
---|---|
ParseACEZipFile()
|
Method Summary | |
---|---|
static void |
add(java.lang.String zip_file,
java.lang.String file_path)
Adds a single ACE XML file to an existing ACE project zip folder. |
static java.lang.String[] |
extract(java.lang.String file_name,
java.lang.String zip_file,
java.lang.String file_type,
java.lang.String destpath)
Extracts the specified file(s) from the given zip file. |
static java.lang.String |
parseZip(java.lang.String zipfile,
java.lang.String destination)
Coordinates the the extraction of an ACE project zip file. |
static void |
saveZip(java.lang.String[] files2,
java.lang.String name)
Saves all of the given files into a compressed zipfile. |
static void |
saveZip(java.lang.String project_path,
java.lang.String project_name)
Given the path to an ACE XML project file and the name of this ACE project, this method retrieves the paths to the componant ACE XML files contained in the project file and then calls the other saveZip method to save them all in a zip file. |
static void |
saveZip(java.lang.String taxonomy_path,
java.lang.String[] feature_defs_paths,
java.lang.String[] data_set_paths,
java.lang.String[] classification_paths,
java.lang.String[] other_paths,
java.lang.String project_name)
Saves an ACE project in a zip file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParseACEZipFile()
Method Detail |
---|
public static java.lang.String parseZip(java.lang.String zipfile, java.lang.String destination) throws java.lang.Exception
After the zip file is extracted, a new ACE XML project file is written specifying the paths to the newly extracted files.
zipfile
- Specifies the path to the zip file that the user wishes to extractdestination
- Specifies the path to the folder to which the contents of the zip file will be extracted
java.lang.Exception
- Throws an exception if an error occurspublic static void saveZip(java.lang.String taxonomy_path, java.lang.String[] feature_defs_paths, java.lang.String[] data_set_paths, java.lang.String[] classification_paths, java.lang.String[] other_paths, java.lang.String project_name) throws java.lang.Exception
Given the paths to all componant ACE XML files, this method combines
all files into a compressed Zip file. An ACE XML project file will written
to specify the given file paths and will be included in the zip file. All
files to be included in the zip file are combined into one array before being
passed to method compress
.
taxonomy_path
- Specifies the path to the taxonomy file for
the ACE project.classification_paths
- Specifies the path(s) to the classification
file(s) for the ACE project.feature_defs_paths
- Specifies the path(s) to the feature definitions/key
file(s) for the ACE project.data_set_paths
- Specifies the path(s) to the data set/feature
vectors file(s) for the ACE project.other_paths
- Specifies the path(s) to any other (non ACE
XML) files that the user wishes to compress.project_name
- This will be the name of the compressed zip
file and the ACE XML project file (with extensions
.zip and .xml respectively).
java.lang.Exception
- If no files are specified to be zipped.public static void saveZip(java.lang.String project_path, java.lang.String project_name) throws java.lang.Exception
project_path
- Specifies the path to the ACE XML Project fileproject_name
- Specifies the name of the project. This will
be the name of the new zip file.
java.lang.Exception
- If an error occurspublic static void saveZip(java.lang.String[] files2, java.lang.String name) throws java.lang.Exception
files2
- The files to be compressed.name
- The name of the zipfile into which the files will be saved.
java.lang.Exception
- If an error occurs.public static java.lang.String[] extract(java.lang.String file_name, java.lang.String zip_file, java.lang.String file_type, java.lang.String destpath) throws java.lang.Exception
If file_type is not null, all files of that file type contained in the zip file will be extracted. Otherwise, the single file specified by file_name will be extracted.
file_name
- If file_type is null, this specifies the name of the
single file to be extracted from the zip_file.zip_file
- Specifies the path to the zip file containing the file(s) to be extractedfile_type
- Can be either "project_file", "taxonomy_file", "feature_key_file", "feature_vector_file",
or "classifications_file". If filetype is not one of these
Strings, an exception will be thrown.destpath
- Specifies the directory into which the file(s) should
be extracted.
java.lang.Exception
- If incorrect filetype is specifiedpublic static void add(java.lang.String zip_file, java.lang.String file_path) throws java.lang.Exception
*note*: In the event that a taxonomy file is specified to be added, any previously stored taxonomy file will be discarded. The file will not be deleted but it will no longer be a part of this ACE project. With any other ACE XMl file type, the new file is simply added to the appropriate array.
file_type
- Specifies the type of ACE XML file to be added.
This can be either: "taxonomy", "feature_settings", "feature_vectors", or "classifications"zip_file
- Specifies the path to the zip file to which the file
specified in file_path is to be added.file_path
- Specifies the path to the file to be added to the zip file
java.lang.Exception
- If invalid filetype is specified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |