public class CDFLibrary
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
DATASETATTRIBUTE_FIELD_DESCRIPTION |
private static java.lang.String |
DATASETATTRIBUTE_UNITS |
private static java.lang.String |
PATH_SEPARATOR |
private static java.lang.String |
XMLFILENAME |
| Constructor and Description |
|---|
CDFLibrary() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(int dataset_id,
byte[] attribute_value,
java.lang.String attribute_type)
Insert a description in UTF-8 format into the dataset identified by datase_id.
|
void |
closeFile(int file_id)
Close a CDF file
|
void |
createDataset(int file_id,
java.lang.String datasetname,
java.lang.String groupName,
DataStructure<?> dset_data,
java.lang.String attribute_units,
java.lang.String field_description)
Create a new dataset named datasetname into the group groupName
|
int |
createFile(java.lang.String cdfFileName)
Create a new CDF file named cdfFileName and return its id
|
int |
createGroup(int file_id,
java.lang.String groupName)
Create a new group named groupName in the file referenced by file_id and return the id of the new group
|
private void |
createIntegerDoubleDataset(int file_id,
java.lang.String datasetname,
java.lang.String groupName,
DataStructure<?> dset_data,
java.lang.String attribute_units,
java.lang.String field_description) |
private void |
createStringDataset(int file_id,
java.lang.String datasetname,
java.lang.String groupName,
DataStructure<?> dset_data,
java.lang.String attribute_units,
java.lang.String field_description) |
KeywordsBean |
getKeywords()
Read and parse the xml file and return the it through the associated bean
|
int |
openFile(java.lang.String cdfFileName)
Open a CDF file named cdfFileName.
|
void |
printGroup(int g_id,
java.lang.String indent)
Recursively print a group and its members.
|
DataStructure<?> |
readDoubleDataset(int file_id,
java.lang.String dsetname)
Read a dataset (dsetname) of double values and return a DataStructure
|
DataStructure<?> |
readIntegerDataset(int file_id,
java.lang.String dsetname)
Read a dataset (dsetname) of int values and return a DataStructure
|
private KeywordsBean |
readKeywordsXML() |
DataStructure<?> |
readStringDataset(int file_id,
java.lang.String dsetname)
Read a dataset (dsetname) of String values and return a DataStructure
|
boolean |
saveKeywords(KeywordsBean keywords)
Save in xml format the keywords bean
|
private static final java.lang.String PATH_SEPARATOR
private static final java.lang.String DATASETATTRIBUTE_UNITS
private static final java.lang.String DATASETATTRIBUTE_FIELD_DESCRIPTION
private static final java.lang.String XMLFILENAME
public DataStructure<?> readDoubleDataset(int file_id, java.lang.String dsetname)
file_id - identifier of CDF file returned by openFile(String) or createFile(String)dsetname - Path of Dataset to read. String have to start with "/" char.public DataStructure<?> readIntegerDataset(int file_id, java.lang.String dsetname)
file_id - identifier of CDF file returned by openFile(String) or createFile(String)dsetname - Path of Dataset to read. String have to start with "/" char.public DataStructure<?> readStringDataset(int file_id, java.lang.String dsetname)
file_id - identifier of CDF file returned by openFile(String) or createFile(String)dsetname - Path of Dataset to read. String have to start with "/" char.public void printGroup(int g_id,
java.lang.String indent)
throws java.lang.Exception
g_id - Identifier of a groupindent - Indentation of output stringjava.lang.Exceptionpublic int createGroup(int file_id,
java.lang.String groupName)
file_id - id of the file where to create the new groupgroupName - name of the group to be created. The string have to start with "/" char.public void addAttribute(int dataset_id,
byte[] attribute_value,
java.lang.String attribute_type)
dataset_id - Identifier of datasetattribute_value - Description to insertattribute_type - Used as prefix of description. Only "Description" and "Units" are used with this librarypublic void createDataset(int file_id,
java.lang.String datasetname,
java.lang.String groupName,
DataStructure<?> dset_data,
java.lang.String attribute_units,
java.lang.String field_description)
file_id - Identifier of CDF filedatasetname - Name of the dataset to be createdgroupName - Name of the group where to create the new dataset. groupName have to start with "/" char.dset_data - Values of the new datasetattribute_units - Units attribute for datasetfield_description - Description attribute for datasetprivate void createIntegerDoubleDataset(int file_id,
java.lang.String datasetname,
java.lang.String groupName,
DataStructure<?> dset_data,
java.lang.String attribute_units,
java.lang.String field_description)
private void createStringDataset(int file_id,
java.lang.String datasetname,
java.lang.String groupName,
DataStructure<?> dset_data,
java.lang.String attribute_units,
java.lang.String field_description)
public int createFile(java.lang.String cdfFileName)
cdfFileName - Name of CDF file to be createdpublic int openFile(java.lang.String cdfFileName)
cdfFileName - The name of CDF file to open.public void closeFile(int file_id)
throws ncsa.hdf.hdf5lib.exceptions.HDF5LibraryException
file_id - the identifier of the file to be closedncsa.hdf.hdf5lib.exceptions.HDF5LibraryExceptionpublic KeywordsBean getKeywords()
public boolean saveKeywords(KeywordsBean keywords)
keywords - Bean with defined keywordsprivate KeywordsBean readKeywordsXML()