gsfc.nssdc.cdf.util
Class CDFUtils

java.lang.Object
  extended by gsfc.nssdc.cdf.util.CDFUtils
All Implemented Interfaces:
CDFConstants

public class CDFUtils
extends java.lang.Object
implements CDFConstants

This class contains the handy utility routines (methods) called by the core CDF Java APIs.

Version:
1.0

Field Summary
 
Fields inherited from interface gsfc.nssdc.cdf.CDFConstants
AHUFF_COMPRESSION, ALPHAOSF1_DECODING, ALPHAOSF1_ENCODING, ALPHAVMSd_DECODING, ALPHAVMSd_ENCODING, ALPHAVMSg_DECODING, ALPHAVMSg_ENCODING, ALPHAVMSi_DECODING, ALPHAVMSi_ENCODING, ATTR_, ATTR_EXISTENCE_, ATTR_EXISTS, ATTR_MAXgENTRY_, ATTR_MAXrENTRY_, ATTR_MAXzENTRY_, ATTR_NAME_, ATTR_NAME_TRUNC, ATTR_NUMBER_, ATTR_NUMgENTRIES_, ATTR_NUMrENTRIES_, ATTR_NUMzENTRIES_, ATTR_SCOPE_, BACKWARD_, BACKWARDFILEoff, BACKWARDFILEon, BAD_ALLOCATE_RECS, BAD_ARGUMENT, BAD_ATTR_NAME, BAD_ATTR_NUM, BAD_BLOCKING_FACTOR, BAD_CACHE_SIZE, BAD_CDF_EXTENSION, BAD_CDF_ID, BAD_CDF_NAME, BAD_CDFSTATUS, BAD_CHECKSUM, BAD_COMPRESSION_PARM, BAD_DATA_TYPE, BAD_DECODING, BAD_DIM_COUNT, BAD_DIM_INDEX, BAD_DIM_INTERVAL, BAD_DIM_SIZE, BAD_ENCODING, BAD_ENTRY_NUM, BAD_FNC_OR_ITEM, BAD_FORMAT, BAD_INITIAL_RECS, BAD_MAJORITY, BAD_MALLOC, BAD_NEGtoPOSfp0_MODE, BAD_NUM_DIMS, BAD_NUM_ELEMS, BAD_NUM_VARS, BAD_READONLY_MODE, BAD_REC_COUNT, BAD_REC_INTERVAL, BAD_REC_NUM, BAD_SCOPE, BAD_SCRATCH_DIR, BAD_SPARSEARRAYS_PARM, BAD_VAR_NAME, BAD_VAR_NUM, BAD_zMODE, CANNOT_ALLOCATE_RECORDS, CANNOT_CHANGE, CANNOT_COMPRESS, CANNOT_COPY, CANNOT_SPARSEARRAYS, CANNOT_SPARSERECORDS, CDF_, CDF_ACCESS_, CDF_ATTR_NAME_LEN, CDF_ATTR_NAME_LEN256, CDF_BYTE, CDF_CACHESIZE_, CDF_CHAR, CDF_CHECKSUM_, CDF_CLOSE_ERROR, CDF_COMPRESSION_, CDF_COPYRIGHT_, CDF_COPYRIGHT_LEN, CDF_CREATE_ERROR, CDF_DECODING_, CDF_DELETE_ERROR, CDF_DOUBLE, CDF_ENCODING_, CDF_EPOCH, CDF_EPOCH16, CDF_EXISTS, CDF_FLOAT, CDF_FORMAT_, CDF_INCREMENT_, CDF_INFO_, CDF_INT1, CDF_INT2, CDF_INT4, CDF_INT8, CDF_INTERNAL_ERROR, CDF_MAJORITY_, CDF_MAX_DIMS, CDF_MAX_PARMS, CDF_MIN_DIMS, CDF_NAME_, CDF_NAME_TRUNC, CDF_NEGtoPOSfp0_MODE_, CDF_NUMATTRS_, CDF_NUMgATTRS_, CDF_NUMrVARS_, CDF_NUMvATTRS_, CDF_NUMzVARS_, CDF_OK, CDF_OPEN_ERROR, CDF_PATHNAME_LEN, CDF_READ_ERROR, CDF_READONLY_MODE_, CDF_REAL4, CDF_REAL8, CDF_RELEASE_, CDF_SAVE_ERROR, CDF_SCRATCHDIR_, CDF_STATUS_, CDF_STATUSTEXT_LEN, CDF_TIME_TT2000, CDF_UCHAR, CDF_UINT1, CDF_UINT2, CDF_UINT4, CDF_VAR_NAME_LEN, CDF_VAR_NAME_LEN256, CDF_VERSION_, CDF_WARN, CDF_WRITE_ERROR, CDF_zMODE_, CDFwithSTATS_, CHECKSUM_, CHECKSUM_ERROR, CHECKSUM_NOT_ALLOWED, CLOSE_, COLUMN_MAJOR, COMPRESS_CACHESIZE_, COMPRESSION_ERROR, CONFIRM_, CORRUPTED_V2_CDF, CORRUPTED_V3_CDF, CREATE_, CURgENTRY_EXISTENCE_, CURrENTRY_EXISTENCE_, CURzENTRY_EXISTENCE_, DATATYPE_MISMATCH, DATATYPE_SIZE_, DECOMPRESSION_ERROR, DECSTATION_DECODING, DECSTATION_ENCODING, DEFAULT_BYTE_PADVALUE, DEFAULT_CHAR_PADVALUE, DEFAULT_DOUBLE_PADVALUE, DEFAULT_EPOCH_PADVALUE, DEFAULT_EPOCH16_PADVALUE, DEFAULT_FLOAT_PADVALUE, DEFAULT_INT1_PADVALUE, DEFAULT_INT2_PADVALUE, DEFAULT_INT4_PADVALUE, DEFAULT_INT8_PADVALUE, DEFAULT_REAL4_PADVALUE, DEFAULT_REAL8_PADVALUE, DEFAULT_TT2000_PADVALUE, DEFAULT_UCHAR_PADVALUE, DEFAULT_UINT1_PADVALUE, DEFAULT_UINT2_PADVALUE, DEFAULT_UINT4_PADVALUE, DELETE_, DID_NOT_COMPRESS, EMPTY_COMPRESSED_CDF, END_OF_VAR, EPOCH_STRING_LEN, EPOCH_STRING_LEN_EXTEND, EPOCH1_STRING_LEN, EPOCH1_STRING_LEN_EXTEND, EPOCH2_STRING_LEN, EPOCH2_STRING_LEN_EXTEND, EPOCH3_STRING_LEN, EPOCH3_STRING_LEN_EXTEND, EPOCH4_STRING_LEN, EPOCH4_STRING_LEN_EXTEND, EPOCHx_FORMAT_MAX, EPOCHx_STRING_MAX, FILLED_TT2000_VALUE, FORCED_PARAMETER, gENTRY_, gENTRY_DATA_, gENTRY_DATASPEC_, gENTRY_DATATYPE_, gENTRY_EXISTENCE_, gENTRY_NUMELEMS_, GET_, GETCDFCHECKSUM_, GETCDFFILEBACKWARD_, GETCDFVALIDATE_, GETLEAPSECONDSENVVAR_, GLOBAL_SCOPE, GZIP_COMPRESSION, HOST_DECODING, HOST_ENCODING, HP_DECODING, HP_ENCODING, HUFF_COMPRESSION, IBM_PC_OVERFLOW, IBMPC_DECODING, IBMPC_ENCODING, IBMRS_DECODING, IBMRS_ENCODING, ILLEGAL_EPOCH_FIELD, ILLEGAL_EPOCH_VALUE, ILLEGAL_FOR_SCOPE, ILLEGAL_IN_zMODE, ILLEGAL_ON_V1_CDF, ILLEGAL_TT2000_VALUE, IS_A_NETCDF, LIB_COPYRIGHT_, LIB_INCREMENT_, LIB_RELEASE_, LIB_subINCREMENT_, LIB_VERSION_, MAC_DECODING, MAC_ENCODING, MD5_CHECKSUM, MULTI_FILE, MULTI_FILE_FORMAT, NA_FOR_VARIABLE, NEGATIVE_FP_ZERO, NEGtoPOSfp0off, NEGtoPOSfp0on, NETWORK_DECODING, NETWORK_ENCODING, NeXT_DECODING, NeXT_ENCODING, NO_ATTR_SELECTED, NO_CDF_SELECTED, NO_CHECKSUM, NO_COMPRESSION, NO_DELETE_ACCESS, NO_ENTRY_SELECTED, NO_MORE_ACCESS, NO_PADVALUE_SPECIFIED, NO_SPARSEARRAYS, NO_SPARSERECORDS, NO_STATUS_SELECTED, NO_SUCH_ATTR, NO_SUCH_CDF, NO_SUCH_ENTRY, NO_SUCH_RECORD, NO_SUCH_VAR, NO_VAR_SELECTED, NO_VARS_IN_CDF, NO_WRITE_ACCESS, NONE_CHECKSUM, NOT_A_CDF, NOT_A_CDF_OR_NOT_SUPPORTED, NOVARY, NULL_, OPEN_, OPTIMAL_ENCODING_TREES, OTHER_CHECKSUM, PAD_SPARSERECORDS, PPC_DECODING, PPC_ENCODING, PRECEEDING_RECORDS_ALLOCATED, PREV_SPARSERECORDS, PUT_, READ_ONLY_DISTRIBUTION, READ_ONLY_MODE, READONLYoff, READONLYon, rENTRY_, rENTRY_DATA_, rENTRY_DATASPEC_, rENTRY_DATATYPE_, rENTRY_EXISTENCE_, rENTRY_NAME_, rENTRY_NUMELEMS_, RLE_COMPRESSION, RLE_OF_ZEROs, ROW_MAJOR, rVAR_, rVAR_ALLOCATEBLOCK_, rVAR_ALLOCATEDFROM_, rVAR_ALLOCATEDTO_, rVAR_ALLOCATERECS_, rVAR_BLOCKINGFACTOR_, rVAR_CACHESIZE_, rVAR_COMPRESSION_, rVAR_DATA_, rVAR_DATASPEC_, rVAR_DATATYPE_, rVAR_DIMVARYS_, rVAR_EXISTENCE_, rVAR_HYPERDATA_, rVAR_INITIALRECS_, rVAR_MAXallocREC_, rVAR_MAXREC_, rVAR_NAME_, rVAR_nINDEXENTRIES_, rVAR_nINDEXLEVELS_, rVAR_nINDEXRECORDS_, rVAR_NUMallocRECS_, rVAR_NUMBER_, rVAR_NUMELEMS_, rVAR_NUMRECS_, rVAR_PADVALUE_, rVAR_RECORDS_, rVAR_RECORDS_RENUMBER_, rVAR_RECVARY_, rVAR_RESERVEPERCENT_, rVAR_SEQDATA_, rVAR_SEQPOS_, rVAR_SPARSEARRAYS_, rVAR_SPARSERECORDS_, rVARs_CACHESIZE_, rVARs_DIMCOUNTS_, rVARs_DIMINDICES_, rVARs_DIMINTERVALS_, rVARs_DIMSIZES_, rVARs_MAXREC_, rVARs_NUMDIMS_, rVARs_RECCOUNT_, rVARs_RECDATA_, rVARs_RECINTERVAL_, rVARs_RECNUMBER_, SAVE_, SCRATCH_CREATE_ERROR, SCRATCH_DELETE_ERROR, SCRATCH_READ_ERROR, SCRATCH_WRITE_ERROR, SELECT_, SGi_DECODING, SGi_ENCODING, SINGLE_FILE, SINGLE_FILE_FORMAT, SOME_ALREADY_ALLOCATED, STAGE_CACHESIZE_, STATUS_TEXT_, SUN_DECODING, SUN_ENCODING, TOO_MANY_PARMS, TOO_MANY_VARS, TT2000_0_STRING_LEN, TT2000_1_STRING_LEN, TT2000_2_STRING_LEN, TT2000_3_STRING_LEN, TT2000_TIME_ERROR, UNABLE_TO_PROCESS_CDF, UNKNOWN_COMPRESSION, UNKNOWN_SPARSENESS, UNSUPPORTED_OPERATION, VALIDATE_, VALIDATEFILEoff, VALIDATEFILEon, VAR_ALREADY_CLOSED, VAR_CLOSE_ERROR, VAR_CREATE_ERROR, VAR_DELETE_ERROR, VAR_EXISTS, VAR_NAME_TRUNC, VAR_OPEN_ERROR, VAR_READ_ERROR, VAR_SAVE_ERROR, VAR_WRITE_ERROR, VARIABLE_SCOPE, VARY, VAX_DECODING, VAX_ENCODING, VIRTUAL_RECORD_DATA, zENTRY_, zENTRY_DATA_, zENTRY_DATASPEC_, zENTRY_DATATYPE_, zENTRY_EXISTENCE_, zENTRY_NAME_, zENTRY_NUMELEMS_, zMODEoff, zMODEon1, zMODEon2, zVAR_, zVAR_ALLOCATEBLOCK_, zVAR_ALLOCATEDFROM_, zVAR_ALLOCATEDTO_, zVAR_ALLOCATERECS_, zVAR_BLOCKINGFACTOR_, zVAR_CACHESIZE_, zVAR_COMPRESSION_, zVAR_DATA_, zVAR_DATASPEC_, zVAR_DATATYPE_, zVAR_DIMCOUNTS_, zVAR_DIMINDICES_, zVAR_DIMINTERVALS_, zVAR_DIMSIZES_, zVAR_DIMVARYS_, zVAR_EXISTENCE_, zVAR_HYPERDATA_, zVAR_INITIALRECS_, zVAR_MAXallocREC_, zVAR_MAXREC_, zVAR_NAME_, zVAR_nINDEXENTRIES_, zVAR_nINDEXLEVELS_, zVAR_nINDEXRECORDS_, zVAR_NUMallocRECS_, zVAR_NUMBER_, zVAR_NUMDIMS_, zVAR_NUMELEMS_, zVAR_NUMRECS_, zVAR_PADVALUE_, zVAR_RECCOUNT_, zVAR_RECINTERVAL_, zVAR_RECNUMBER_, zVAR_RECORDS_, zVAR_RECORDS_RENUMBER_, zVAR_RECVARY_, zVAR_RESERVEPERCENT_, zVAR_SEQDATA_, zVAR_SEQPOS_, zVAR_SPARSEARRAYS_, zVAR_SPARSERECORDS_, zVARs_CACHESIZE_, zVARs_MAXREC_, zVARs_RECDATA_, zVARs_RECNUMBER_
 
Constructor Summary
CDFUtils()
           
 
Method Summary
static boolean cdfFileExists(java.lang.String fileName)
          Checks the existence of the given CDF file name.
static long getDataTypeValue(java.lang.String cdfDataType)
          Gets the long value of the given CDF data type in string.
static long getLongChecksum(java.lang.String checksum)
          Gets the long value of the given CDF's checksum in string.
static long getLongCompressionType(java.lang.String compressionType)
          Gets the long representation of the given CDF compression type in string.
static long getLongEncoding(java.lang.String encodingType)
          Gets the long value of the given CDF encoding type in string.
static long getLongFormat(java.lang.String formatType)
          Gets the long value of the given CDF file format in string.
static long getLongMajority(java.lang.String majorityType)
          Gets the long value of the given CDF majority.
static long getLongSparseRecord(java.lang.String sparseRecordType)
          Gets the long value of the given sparse record type in string.
static long getNumElements(long dataType, java.lang.Object data)
          Gets the number of elements contained in the given data object.
static java.lang.String getSignature(java.lang.Object obj)
          Gets the java signature of the given object.
static java.lang.String getStringChecksum(CDF cdf)
          Gets the string value of the given CDF's checksum.
static java.lang.String getStringChecksum(long checksumType)
          Gets the string value of the given CDF's checksum.
static java.lang.String getStringCompressionType(CDF cdf)
          Gets the string representation of the given CDF file's compression type.
static java.lang.String getStringCompressionType(long compressionType)
          Gets the string representation of the given CDF compression type.
static java.lang.String getStringCompressionType(Variable var)
          Gets the string representation of the given variable's compression type.
static java.lang.String getStringData(java.lang.Object data)
          Returns the string value of the given data.
static java.lang.String getStringData(java.lang.Object data, int epochType)
          Returns the string value of the given data.
static java.lang.String getStringData(java.lang.Object data, java.lang.String separator)
          returns the string of the value of the given data.
static java.lang.String getStringData(java.lang.Object data, java.lang.String separator, int epochType)
          returns the string of the value of the given data.
static java.lang.String getStringDataType(Entry entry)
          Gets the string value of the CDF data type for the given entry.
static java.lang.String getStringDataType(long cdfDataType)
          Gets the string representation of the given CDF data type.
static java.lang.String getStringDataType(Variable var)
          Gets the string value of the CDF data type for the given variable.
static java.lang.String getStringDecoding(CDF cdf)
          Gets the string value of the given CDF file's decoding type.
static java.lang.String getStringDecoding(long decodingType)
          Gets the string value of the given CDF decoding type .
static java.lang.String getStringEncoding(CDF cdf)
          Get the string value of the given CDF's encoding type.
static java.lang.String getStringEncoding(long encodingType)
          Gets the string value of the given CDF encoding type.
static java.lang.String getStringFormat(CDF cdf)
          Gets the string value of the given CDF's file format.
static java.lang.String getStringFormat(long formatType)
          Gets the string value of the given CDF's file format.
static java.lang.String getStringMajority(CDF cdf)
          Gets the string value of the given CDF file's majority.
static java.lang.String getStringMajority(long majorityType)
          Gets the string value of the given CDF majority.
static java.lang.String getStringSparseRecord(long sparseRecordType)
          Gets the string value of the given sparse record type.
static java.lang.String getStringSparseRecord(Variable var)
          Gets the string value of the given variable's sparse record type.
static boolean isEpochDataType(long dataType)
          Returns whether a CDF data type is an epoch related type.
static boolean isStringDataType(long dataType)
          Returns whether a CDF data type is a string type.
static void printData(java.lang.Object data)
          Prints the value of the given data on the screen.
static void printData(java.lang.Object data, int which)
          Prints the value of the given data on the screen.
static void printData(java.lang.Object data, int which, boolean iso8601)
          Prints the value of the given data on the screen.
static void printData(java.lang.Object data, java.io.PrintWriter outWriter)
          Prints the value of the given data to the place designated by PrintWriter that can be a file, Sysem.out, System.err, and etc.
static void printData(java.lang.Object data, java.io.PrintWriter outWriter, int which)
          Prints the value of the given data to the place designated by PrintWriter that can be a file, Sysem.out, System.err, and etc.
static void printData(java.lang.Object data, java.io.PrintWriter outWriter, int which, boolean iso8601)
          Prints the value of the given data to the place designated by PrintWriter that can be a file, Sysem.out, System.err, and etc.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDFUtils

public CDFUtils()
Method Detail

getSignature

public static java.lang.String getSignature(java.lang.Object obj)
Gets the java signature of the given object.

NOTE: Java primitive data types (e.g. int, long, byte, etc.) are not Objects. Thus they must be passed-in as an Object by using a wrapper (e.g. Integer(23)).

 
  Signature                 Java Programming Language Type
  ---------                 ------------------------------
  [Z                        array of boolean
  [B                        array of byte
  [C                        array of char
  [S                        array of short
  [I                        array of int
  [J                        array of long
  [F                        array of float
  [D                        array of double 

L fully-qualified-class fully-qualified class L fully-qualified-class; array of fully-qualified class java.lang.Boolean Boolean Ljava.lang.Boolean; array of Boolean java.lang.Byte Byte Ljava.lang.Byte; array of Byte java.lang.Short Short Ljava.lang.Short; array of Short java.lang.Integer Integer Ljava.lang.Integer; array of Integer java.lang.Long Long Ljava.lang.Long; array of Long java.lang.Float Float Ljava.lang.Float; array of Float java.lang.Double Double Ljava.lang.Double; array of Double java.lang.String String Ljava.lang.String; array of String

Parameters:
obj - the object from which Java signature is retrieved

Returns:
Java signature of the given object

getNumElements

public static long getNumElements(long dataType,
                                  java.lang.Object data)
                           throws CDFException
Gets the number of elements contained in the given data object.

Parameters:
dataType - the CDF data type of the object to be examined

data - the data object to be examined

Returns:
If the data is a string: number of characters in the string
If the data is an array: number of elements in the array
Otherwise: 1

Throws:
CDFException - if a problem occurs getting the number of elements

printData

public static void printData(java.lang.Object data)
Prints the value of the given data on the screen. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be printed

printData

public static void printData(java.lang.Object data,
                             int which,
                             boolean iso8601)
Prints the value of the given data on the screen. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be printed
which - the Epoch data type data indicator 1 if CDF_EPOCH, 2 if CDF_EPOCH16 or 3 if CDF_TIME_TT2000
iso8601 - the ISO 8601 indicator for EPOCH data

printData

public static void printData(java.lang.Object data,
                             int which)
Prints the value of the given data on the screen. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be printed
which - the Epoch data type data indicator 1 if CDF_EPOCH, 2 if CDF_EPOCH16 or 3 if CDF_TIME_TT2000

printData

public static void printData(java.lang.Object data,
                             java.io.PrintWriter outWriter)
Prints the value of the given data to the place designated by PrintWriter that can be a file, Sysem.out, System.err, and etc. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

The following example will send the contents of the given data to "myoutput.dat".

     OutputStreamWriter outWriter = null;
     PrintWriter out = null;
     try {
          outWriter = new OutputStreamWriter("myoutput.dat", "UTF-8");
          out = new PrintWriter(outWriter, true);
     } catch (Exception e) {
         System.out.println ("Exception occurred: "+e);
     }
     CDFUtils.printData (data, out);
  

Parameters:
data - the data to be printed

outWriter - the print writer to which formatted representations of the object/data is printed as a text-output stream

printData

public static void printData(java.lang.Object data,
                             java.io.PrintWriter outWriter,
                             int which)
Prints the value of the given data to the place designated by PrintWriter that can be a file, Sysem.out, System.err, and etc. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be printed

outWriter - the print writer to which formatted representations of the object/data is printed as a text-output stream
which - the Epoch data type data indicator 1 if CDF_EPOCH, 2 if CDF_EPOCH16 or 3 if CDF_TIME_TT2000

printData

public static void printData(java.lang.Object data,
                             java.io.PrintWriter outWriter,
                             int which,
                             boolean iso8601)
Prints the value of the given data to the place designated by PrintWriter that can be a file, Sysem.out, System.err, and etc. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be printed

outWriter - the print writer to which formatted representations of the object/data is printed as a text-output stream
which - the Epoch data type data indicator 1 if CDF_EPOCH, 2 if CDF_EPOCH16 or 3 if CDF_TIME_TT2000
iso8601 - the ISO 8601 indicator for EPOCH data

getStringData

public static java.lang.String getStringData(java.lang.Object data)
Returns the string value of the given data. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be parsed

Returns:
The string value of the given data/object.
If the data is an array, its elements are delimited by a space.

getStringData

public static java.lang.String getStringData(java.lang.Object data,
                                             int epochType)
Returns the string value of the given data. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be parsed

epochType - epoch type indicator (==1 CDF_EPOCH, ==2 CDF_EPOCH16, ==0 others)

Returns:
The string value of the given data/object.
If the data is an array, its elements are delimited by a space.

getStringData

public static java.lang.String getStringData(java.lang.Object data,
                                             java.lang.String separator)
returns the string of the value of the given data. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be parsed

separator - the delimiter for array elements

Returns:
The string value of the given data/object.
If the data is an array, its elements are delimited by the user defined separator.

getStringData

public static java.lang.String getStringData(java.lang.Object data,
                                             java.lang.String separator,
                                             int epochType)
returns the string of the value of the given data. Data can be a java primitive data type, Java Object (non-array), or 1-dimensional array of primitive Java data type.

Parameters:
data - the data to be parsed

separator - the delimiter for array elements

epochType - Epoch or Epoch16 data type indicator
== 1 for EPOCH, == 2 for EPOCH16, == 3 for TT2000, == 0 for other data types

Returns:
The string value of the given data/object.
If the data is an array, its elements are delimited by the user defined separator.

getStringDataType

public static java.lang.String getStringDataType(Variable var)
Gets the string value of the CDF data type for the given variable.

Parameters:
var - the CDF variable to be examined

Returns:
See getStringDataType (long cdfDataType) for possible return values.

getStringDataType

public static java.lang.String getStringDataType(Entry entry)
Gets the string value of the CDF data type for the given entry.

Parameters:
entry - the entry to be examined

Returns:
String representation of the entry's CDF data type. See getStringDataType (long cdfDataType) for possible return values.

isStringDataType

public static boolean isStringDataType(long dataType)
Returns whether a CDF data type is a string type.

Parameters:
dataType - the data type to be examined

Returns:
true if it is (CDF_CHAR or CDF_UCHAR) false otherwise

isEpochDataType

public static boolean isEpochDataType(long dataType)
Returns whether a CDF data type is an epoch related type.

Parameters:
dataType - the data type to be examined

Returns:
true if it is (CDF_EPOCH, CDF_EPOCH16 or CDF_TIME_TT2000) false otherwise

getStringDataType

public static java.lang.String getStringDataType(long cdfDataType)
Gets the string representation of the given CDF data type.

Parameters:
cdfDataType - the CDF data type to be examined and translated

It should be one of the following:

  • CDF_BYTE
  • CDF_CHAR
  • CDF_UCHAR
  • CDF_INT1
  • CDF_UINT1
  • CDF_INT2
  • CDF_UINT2
  • CDF_INT4
  • CDF_UINT8
  • CDF_INT8
  • CDF_REAL4
  • CDF_FLOAT
  • CDF_REAL8
  • CDF_DOUBLE
  • CDF_EPOCH
  • CDF_EPOCH16
  • CDF_TIME_TT2000

Returns:
String representation of cdfDataType. The returned value is one of the valid values describe above for cdfDataType. "UNKNOWN" is returned if invalid cdfDataType is given.

getDataTypeValue

public static long getDataTypeValue(java.lang.String cdfDataType)
Gets the long value of the given CDF data type in string. This is a reverse function from getStringDataType.

Parameters:
cdfDataType - the string CDF data type to be examined and translated. It should be one of the following values:
  • CDF_BYTE
  • CDF_CHAR
  • CDF_UCHAR
  • CDF_INT1
  • CDF_UINT1
  • CDF_INT2
  • CDF_UINT2
  • CDF_INT4
  • CDF_UINT4
  • CDF_INT8
  • CDF_REAL4
  • CDF_FLOAT
  • CDF_REAL8
  • CDF_DOUBLE
  • CDF_EPOCH
  • CDF_EPOCH16
  • CDF_TIME_TT2000

Returns:
long representation of cdfDataType. The returned value is one of the valid values described above for cdfDataType. -1 is returned if invalid cdfDataType is given.

getStringCompressionType

public static java.lang.String getStringCompressionType(long compressionType)
Gets the string representation of the given CDF compression type.

Parameters:
compressionType - the CDF compression type to be translated. it should be one of the following:

  • NO_COMPRESSION
  • RLE_COMPRESSION
  • HUFF_COMPRESSION
  • AHUFF_COMPRESSION
  • GZIP_COMPRESSION

Returns:
String representation of compressionType. The returned value is one of the following:
  • NONE
  • RLE
  • Huffman
  • Adaptive Huffman
  • GZIP
  • UNKNOWN (for unknown compressionType)

getLongCompressionType

public static long getLongCompressionType(java.lang.String compressionType)
Gets the long representation of the given CDF compression type in string.

Parameters:
compressionType - the CDF compression type to be translated. It should be one of the following:
  • NONE
  • RLE
  • Huffman
  • Adaptive Huffman
  • GZIP

Returns:
long representation of compressionType. The returned value is one of the following:
  • NO_COMPRESSION
  • RLE_COMPRESSION
  • HUFF_COMPRESSION
  • AHUFF_COMPRESSION
  • GZIP_COMPRESSION
  • -1 (for unknown compressionType)

getStringCompressionType

public static java.lang.String getStringCompressionType(Variable var)
Gets the string representation of the given variable's compression type.

Parameters:
var - the variable to be examined

Returns:
string representation of the given variable's compression type. See getStringCompressionType(long compressionType) for possible return values.

getStringCompressionType

public static java.lang.String getStringCompressionType(CDF cdf)
Gets the string representation of the given CDF file's compression type.

Parameters:
cdf - the CDF to be examined

Returns:
string representation of the given CDF file's compression type. See getStringCompressionType(long compressionType) for possible return values.

getStringEncoding

public static java.lang.String getStringEncoding(long encodingType)
Gets the string value of the given CDF encoding type.

Parameters:
encodingType - the CDF encoding type to be examined. It should be one of the following:
  • NETWORK_ENCODING
  • SUN_ENCODING
  • DECSTATION_ENCODING
  • SGi_ENCODING
  • IBMPC_ENCODING
  • IBMRS_ENCODING
  • HOST_ENCODING
  • PPC_ENCODING
  • HP_ENCODING
  • NeXT_ENCODING
  • ALPHAOSF1_ENCODING
  • ALPHAVMSd_ENCODING
  • ALPHAVMSg_ENCODING
  • ALPHAVMSi_ENCODING

Returns:
string representation of encodingType. The returned value is one of the following:
  • NETWORK
  • SUN
  • DECSTATION
  • SGi
  • IBMPC
  • IBMRS
  • HOST
  • PPC
  • HP
  • NeXT
  • ALPHAOSF1
  • ALPHAVMSd
  • ALPHAVMSg
  • ALPHAVMSi
  • UNKNOWN (for unknown encodingType)

getLongEncoding

public static long getLongEncoding(java.lang.String encodingType)
Gets the long value of the given CDF encoding type in string.

Parameters:
encodingType - the CDF encoding type to be examined. It should be one of the following:
  • NETWORK
  • SUN
  • DECSTATION
  • SGi
  • IBMPC
  • IBMRS
  • HOST
  • PPC
  • HP
  • NeXT
  • ALPHAOSF1
  • ALPHAVMSd
  • ALPHAVMSg
  • ALPHAVMSi

Returns:
long representation of encodingType. The returned value is one of the following:
  • NETWORK_ENCODING
  • SUN_ENCODING
  • DECSTATION_ENCODING
  • SGi_ENCODING
  • IBMPC_ENCODING
  • IBMRS_ENCODING
  • HOST_ENCODING
  • PPC_ENCODING
  • HP_ENCODING
  • NeXT_ENCODING
  • ALPHAOSF1_ENCODING
  • ALPHAVMSd_ENCODING
  • ALPHAVMSg_ENCODING
  • ALPHAVMSi_ENCODING
  • -1 (for unknown encodingType)

getStringEncoding

public static java.lang.String getStringEncoding(CDF cdf)
Get the string value of the given CDF's encoding type.

Parameters:
cdf - the CDF to be examined

Returns:
string representation of the given CDF's encoding type. See getStringEncoding(long encodingType) for possible return values.

getStringDecoding

public static java.lang.String getStringDecoding(long decodingType)
                                          throws CDFException
Gets the string value of the given CDF decoding type

.

Parameters:
decodingType - the CDF decoding type to be examined. It should be one of the following:
  • NETWORK_DECODING
  • SUN_DECODING
  • DECSTATION_DECODING
  • SGi_DECODING
  • IBMPC_DECODING
  • IBMRS_DECODING
  • HOST_DECODING
  • PPC_DECODING
  • HP_DECODING
  • NeXT_DECODING
  • ALPHAOSF1_DECODING
  • ALPHAVMSd_DECODING
  • ALPHAVMSg_DECODING
  • ALPHAVMSi_DECODING
  • -1 (for unknown encodingType)

Returns:
string representation of decodingType. See getStringEncoding (long encodingType) for possible return values.

Throws:
CDFException - if a problem occurs getting the string value of the given decoding type

getStringDecoding

public static java.lang.String getStringDecoding(CDF cdf)
                                          throws CDFException
Gets the string value of the given CDF file's decoding type.

Parameters:
cdf - the CDF to be examined

Returns:
string representation of the given CDF file's decoding type. See getStringEncoding (long encodingType) for possible return values.

Throws:
CDFException - if a problem occurs getting the value of the decoding type defined for the given CDF

getStringMajority

public static java.lang.String getStringMajority(long majorityType)
Gets the string value of the given CDF majority.

Parameters:
majorityType - the CDF majority to be translated

Returns:
string representation of majorityType. The returned value is one of the following:
  • ROW
  • COLUMN
  • UNKNOWN (for unknown majorityType)

getLongMajority

public static long getLongMajority(java.lang.String majorityType)
Gets the long value of the given CDF majority.

Parameters:
majorityType - the CDF majority to be translated. It should be either ROW or COLUMN

Returns:
long representation of majorityType. The returned value is one of the following:
  • ROW_MAJOR
  • COLUMN_MAJOR
  • -1 (for unknown majorityType)

getStringMajority

public static java.lang.String getStringMajority(CDF cdf)
Gets the string value of the given CDF file's majority.

Parameters:
cdf - the CDF to be examined

Returns:
string representation of the given CDF file's majority. The returned value is one of the following:
  • ROW
  • COLUMN

getStringFormat

public static java.lang.String getStringFormat(long formatType)
Gets the string value of the given CDF's file format.

Parameters:
formatType - the CDF file format to be translated. It should be either SINGLE or MULTI

Returns:
string representation of formatType. The returned value is either SINGLE, MULTI, or UNKNOWN.

getLongFormat

public static long getLongFormat(java.lang.String formatType)
Gets the long value of the given CDF file format in string.

Parameters:
formatType - the CDF file format to be translated. It should be either SINGLE or MULTI.

Returns:
long representation of formatType. The returned value is one of the following:
  • SINGLE_FILE
  • MULTI_FILE
  • -1 (for unknown format type)

getStringFormat

public static java.lang.String getStringFormat(CDF cdf)
Gets the string value of the given CDF's file format.

Parameters:
cdf - the CDF to be examined

Returns:
string representation of given CDF's file format. The returned value is either SINGLE, MULTI, or UNKNOWN.

getStringSparseRecord

public static java.lang.String getStringSparseRecord(long sparseRecordType)
Gets the string value of the given sparse record type.

Parameters:
sparseRecordType - the sparse record type to be translated. It should be one of the following:
  • NO_SPARSERECORDS
  • PAD_SPARSERECORDS
  • PREV_SPARSERECORDS

Returns:
string representation of sparseRecordType. The returned value is one of the following:
  • None
  • PAD
  • PREV
  • UNKNOWN

getLongChecksum

public static long getLongChecksum(java.lang.String checksum)
Gets the long value of the given CDF's checksum in string.

Parameters:
checksum - the checksum string of which to be translated.
Returns:
long value of checksum type. The returned value is either NONE_CHECKSUM, MD5_CHECKSUM, or OTHER_CHECKSUM.

getStringChecksum

public static java.lang.String getStringChecksum(CDF cdf)
Gets the string value of the given CDF's checksum.

Parameters:
cdf - the CDF with which its checksum to be translated.
Returns:
string representation of checksum type. The returned value is either NONE, MD5, or OTHER.

getStringChecksum

public static java.lang.String getStringChecksum(long checksumType)
Gets the string value of the given CDF's checksum.

Parameters:
checksumType - the CDF checksum to be translated. It should be either NO_CHECKSUM (or NONE_CHECKSUM) or MD5_CHECKSUM

Returns:
string representation of checksumType. The returned value is either NONE, MD5, or OTHER.

getLongSparseRecord

public static long getLongSparseRecord(java.lang.String sparseRecordType)
Gets the long value of the given sparse record type in string.

Parameters:
sparseRecordType - the sparse record type to be translated. It should be one of the following:
  • None
  • PAD or sRecords.PAD
  • PREV or sRecords.PREV

Returns:
long representation of sparseRecordType. The returned value is one of the following:
  • NO_SPARSERECORDS
  • PAD_SPARSERECORDS
  • PREV_SPARSERECORDS
  • -1 (for unknown sparse record type)

getStringSparseRecord

public static java.lang.String getStringSparseRecord(Variable var)
Gets the string value of the given variable's sparse record type.

Parameters:
var - the variable to be examined

Returns:
string representation of the given variable's sparse record type. The returned value is one of the following:
  • None
  • PAD
  • PREV
  • UNKNOWN

cdfFileExists

public static boolean cdfFileExists(java.lang.String fileName)
Checks the existence of the given CDF file name. If the file name doesn't have ".cdf" file extension, it adds ".cdf" suffix at the end of the file name before checking the existence of the file. If the file exists in the current directory, it returns TRUE. Otherwise, FALSE is returned.

Parameters:
fileName - the name of the CDF file to be checked for existence

Returns:
true - if fileName exists in the current directory
false - if fileName doesn't exist in the current directory