Package gov.nasa.pds.label
Class Label
- java.lang.Object
- 
- gov.nasa.pds.label.Label
 
- 
 public class Label extends java.lang.ObjectImplements a mechanism for accessing labels and the objects they represent.For PDS4 labels, the user should load a label file and access the objects as follows: Label label = Label.open(new File("labelfile.xml"); // Get the tables in the data file. List<TableObject> tables = label.getObjects(TableObject.class); // Read the table record-by-record. TableObject table = tables.get(0); TableRecord record = table.readNext(); while (record != null) { ... process this record ... } label.close();See the package gov.nasa.pds.objectto see all the object types that can be represented in a PDS label.
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the label.LabelStandardgetLabelStandard()Gets the label standard that the label conforms to.java.util.List<DataObject>getObjects()Gets the data objects represented by the label.<T extends DataObject>
 java.util.List<T>getObjects(java.lang.Class<T> clazz)Gets the data objects that are of a given class.java.lang.Class<? extends Product>getProductClass()Gets the object class of the product.ProductTypegetProductType()Gets the type of the product, as an enumerated type.java.lang.StringgetStandardVersion()Returns the version number of the label standard used by the product.static Labelopen(java.io.File labelFile)Opens a label from a file.static Labelopen(java.net.URL label)Opens a label from a url.
 
- 
- 
- 
Method Detail- 
closepublic void close() Closes the label. All further calls on the label may generate errors.
 - 
openpublic static Label open(java.io.File labelFile) throws ParseException Opens a label from a file.- Parameters:
- labelFile- the label file
- Returns:
- the label
- Throws:
- ParseException- if there is an error reading the label from the file
 
 - 
openpublic static Label open(java.net.URL label) throws ParseException Opens a label from a url.- Parameters:
- label- the label url
- Returns:
- the label
- Throws:
- ParseException- if there is an error reading the label from the url
 
 - 
getLabelStandardpublic LabelStandard getLabelStandard() Gets the label standard that the label conforms to.- Returns:
- the label standard
 
 - 
getStandardVersionpublic java.lang.String getStandardVersion() Returns the version number of the label standard used by the product.- Returns:
- the label standard version number, as a string
 
 - 
getProductClasspublic java.lang.Class<? extends Product> getProductClass() Gets the object class of the product.- Returns:
- the product object class
 
 - 
getProductTypepublic ProductType getProductType() Gets the type of the product, as an enumerated type.- Returns:
- the product type
 
 - 
getObjectspublic java.util.List<DataObject> getObjects() throws java.lang.Exception Gets the data objects represented by the label.- Returns:
- a list of data objects
- Throws:
- java.lang.Exception- if there is an error accessing the objects in the product
 
 - 
getObjectspublic <T extends DataObject> java.util.List<T> getObjects(java.lang.Class<T> clazz) throws java.lang.Exception Gets the data objects that are of a given class.- Type Parameters:
- T- the class of the objects desired
- Parameters:
- clazz- the class object of the object class
- Returns:
- a list of data objects
- Throws:
- java.lang.Exception- if there is an error accessing the objects in the product
 
 
- 
 
-