Class FileMetadataExtractor
java.lang.Object
gov.nasa.pds.registry.common.meta.FileMetadataExtractor
Extracts file metadata, such as file name, size, checksum.
- Author:
- karpenko
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextract(File file, Metadata meta, List<FileRefRule> refRules) Extract file metadataDeflate (zip) PDS XML label and then Base64 encode.static StringgetJsonBlob(File file) Convert PDS XML label into JSON, deflate (zip) and then Base64 encode.Calculate MD5 hash of a filevoidsetProcessDataFiles(boolean process) Set a flag to process data files.voidsetStoreLabels(boolean storeXml, boolean storeJson) Set flags to store PDS labels in XML and JSON format.
-
Constructor Details
-
FileMetadataExtractor
Constructor- Throws:
Exception- and exception
-
-
Method Details
-
setStoreLabels
public void setStoreLabels(boolean storeXml, boolean storeJson) Set flags to store PDS labels in XML and JSON format. Default values are true.- Parameters:
storeXml- store PDS labels in XML formatstoreJson- store PDS labels in JSON format
-
setProcessDataFiles
public void setProcessDataFiles(boolean process) Set a flag to process data files. Default value is true.- Parameters:
process- a flag to process data files.
-
extract
Extract file metadata- Parameters:
file- a filemeta- extracted metadata is added to this objectrefRules- rules to create external file references- Throws:
Exception- an exception
-
getMd5
Calculate MD5 hash of a file- Parameters:
file- a file- Returns:
- HEX encoded MD5 hash
- Throws:
Exception- an exception
-
getBlob
Deflate (zip) PDS XML label and then Base64 encode.- Parameters:
file- PDS XML label- Returns:
- Base64 encoded string
- Throws:
Exception- an exception
-
getJsonBlob
Convert PDS XML label into JSON, deflate (zip) and then Base64 encode.- Parameters:
file- PDS XML label- Returns:
- Base64 encoded string
- Throws:
Exception- an exception
-