public class GenericWriter
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
rowMajority |
| Constructor and Description |
|---|
GenericWriter()
Constructs a column major GenericWriter
|
GenericWriter(boolean rowMajority)
Constructs a GenericWriter of specified row majority
|
| Modifier and Type | Method and Description |
|---|---|
void |
addData(java.lang.String name,
java.lang.Object data)
Adds data to a variable.
|
void |
addData(java.lang.String name,
java.lang.Object data,
boolean relax)
Adds data to a variable.
|
void |
addData(java.lang.String name,
java.lang.Object data,
int[] recordRange)
Adds data for a specified record range to a variable.
|
void |
addData(java.lang.String name,
java.lang.Object data,
int[] recordRange,
boolean relax)
Adds data for a specified record range to a variable.
|
void |
addGlobalAttributeEntry(java.lang.String name,
CDFDataType dataType,
java.lang.Object value)
Adds a global attribute entry of specified type..
|
void |
addGlobalAttributeEntry(java.lang.String name,
java.lang.Object value)
Adds a global attribute entry.
|
void |
addNRVString(java.lang.String name,
java.lang.String value)
Adds an NRV record of string type.
|
void |
addNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size,
java.lang.Object value)
Adds a NRV record of the given type and dimensions.
|
void |
addNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.Object value)
Adds a NRV record of the given numeric type and dimension.
|
void |
addNRVVariable(java.lang.String name,
CDFDataType dataType,
java.lang.Object value)
Adds a scalar NRV record of the given numeric type.
|
void |
addOneD(java.lang.String name,
java.lang.Object data)
Adds data (represented as a one dimensional array) to a variable.
|
void |
addOneD(java.lang.String name,
java.lang.Object data,
boolean relax)
Adds data (represented as a one dimensional array) to a variable.
|
void |
addOneD(java.lang.String name,
java.lang.Object data,
int[] recordRange)
Adds data (represented as a one dimensional array)
for a specified record range to a variable.
|
void |
addOneD(java.lang.String name,
java.lang.Object data,
int[] recordRange,
boolean relax)
Adds data (represented as a one dimensional array)
for a specified record range to a variable.
|
void |
addVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
CDFDataType dataType,
java.lang.Object value)
Sets the value of a given attribute for a variable.
|
void |
addVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
java.lang.Object value)
Sets the value of a given attribute for a variable.
|
void |
defineCompressedStringVariable(java.lang.String name,
int[] dim,
int size)
Defines a compressed variable of string type with given dimensions.
|
void |
defineCompressedTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname,
CDFTimeType timeType)
Defines a time series of the named variable of specified data type and
the time variable of specified name and type.
|
void |
defineCompressedVariable(java.lang.String name,
CDFDataType dataType,
int[] dim)
Defines a compressed variable of specified numeric data type and
|
void |
defineCompressedVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
Defines a compressed variable of string type with given dimensions.
|
void |
defineNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
Defines a NRV record of the given type and dimensions.
|
void |
defineStringVariable(java.lang.String name,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size)
Defines a variable of string type using default
sparse record option.
|
void |
defineStringVariable(java.lang.String name,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size,
SparseRecordOption option)
Defines a variable of string type using given
sparse record option.
|
void |
defineStringVariable(java.lang.String name,
int[] dim,
int size)
Defines a named variable of string data type
|
void |
defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim)
Defines a time series for a new variable of specified data type.
|
void |
defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname)
Defines a time series of the named variable of specified data type
and the time variable of specified name.
|
void |
defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname,
CDFTimeType timeType,
boolean compressed)
Defines a time series of a new named variable of specified data type
and the time variable of specified name and type.
|
void |
defineTimeVariable(java.lang.String name,
CDFTimeType timeType)
Defines a time variable of the specified
time type. |
void |
defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim)
Defines a named variable of specified numeric data type
|
void |
defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad)
Defines a variable of specified numeric data type using default
sparse record option.
|
void |
defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size)
Defines a variable of string type using given
sparse record option.
|
void |
defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size,
SparseRecordOption option)
Defines a new variable
|
void |
defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
SparseRecordOption option)
Defines a variable of specified numeric data type using given
sparse record option.
|
void |
defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
Defines a named variable of specified numeric data type and dimensions.
|
boolean |
hasTimeVariable(java.lang.String name)
Returns whether the time variable has been defined for a variable.
|
void |
setLastLeapSecondId(int n)
Sets the last Leap Second Id.
|
void |
setMD5Needed(boolean need)
Prescribes whether an MD5 digest is to be included in
the output file.
|
void |
setVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
CDFDataType dataType,
java.lang.Object value)
Sets the value of a given attribute for a variable.
|
void |
setVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
java.lang.Object value)
Sets the value of a given attribute for a variable.
|
void |
write(java.lang.String fname)
Writes CDF to a file.
|
boolean |
write(java.lang.String fname,
boolean overwrite)
Writes CDF to a file.
|
public GenericWriter()
public GenericWriter(boolean rowMajority)
rowMajority - a flag indicating the CDF is a row majorpublic void addGlobalAttributeEntry(java.lang.String name,
java.lang.Object value)
throws CDFException.WriterError
name - name of the attributevalue - array or wrapped scalar value to assign to attributeCDFException.WriterError - if there is an errorpublic void addGlobalAttributeEntry(java.lang.String name,
CDFDataType dataType,
java.lang.Object value)
throws CDFException.WriterError
name - name of the attributedataType - CDFDataType desiredvalue - array or wrapped scalar value to assign to attributeCDFException.WriterError - if there is an errorpublic void setVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
java.lang.Object value)
throws CDFException.WriterError
vname - name of the variableaname - name of the attributevalue - array of primitives, or String value to assign to
attributeCDFException.WriterError - if there is an errorpublic void setVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
CDFDataType dataType,
java.lang.Object value)
throws CDFException.WriterError
vname - name of the variableaname - name of the attributedataType - CDFDataType desiredvalue - array of primitives, or String value to assign to
attribute
Overwrites previous value, if anyCDFException.WriterError - if there is an errorpublic void addVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
java.lang.Object value)
throws CDFException.WriterError
vname - name of the variableaname - name of the attributevalue - array of primitives, or String value to assign to
attributeCDFException.WriterError - if there is an errorpublic void addVariableAttributeEntry(java.lang.String vname,
java.lang.String aname,
CDFDataType dataType,
java.lang.Object value)
throws CDFException.WriterError
vname - name of the variableaname - name of the attributedataType - CDFDataType desiredvalue - array of primitives, or String value to assign to
attributeCDFException.WriterError - if there is an errorpublic boolean hasTimeVariable(java.lang.String name)
throws CDFException.WriterError
name - variable nameCDFException.WriterError - if there is an errorpublic void defineTimeVariable(java.lang.String name,
CDFTimeType timeType)
throws CDFException.WriterError
time type.name - variable nametimeType - data typeCDFException.WriterError - if there is an errorpublic void defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionsCDFException.WriterError - if there is an errorpublic void defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionstname - the given variable's time dependent variable nameCDFException.WriterError - if there is an errorpublic void defineCompressedTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname,
CDFTimeType timeType)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionstname - the given variable's time dependent variable nametimeType - data typeCDFException.WriterError - if there is an errorpublic void defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname,
CDFTimeType timeType,
boolean compressed)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionstname - the given variable's time dependent variable nametimeType - data typecompressed - A flag indicating whether the variable is compressedCDFException.WriterError - if there is an errorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionsCDFException.WriterError - if there is an errorpublic void defineStringVariable(java.lang.String name,
int[] dim,
int size)
throws CDFException.WriterError
name - variable namedim - dimensionssize - the number of elementsCDFException.WriterError - if there is an errorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionssize - the number of elementsCDFException.WriterError - if there is an errorpublic void defineCompressedVariable(java.lang.String name,
CDFDataType dataType,
int[] dim)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionsCDFException.WriterError - if there is an errorpublic void defineCompressedStringVariable(java.lang.String name,
int[] dim,
int size)
throws CDFException.WriterError
name - variable namedim - dimensionssize - the number of elementsCDFException.WriterError - if there is an errorpublic void defineCompressedVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionssize - the number of elementsCDFException.WriterError - if there is an errorpublic void addNRVString(java.lang.String name,
java.lang.String value)
throws CDFException.WriterError
name - variable namevalue - data valueCDFException.WriterError - if there is an errorpublic void addNRVVariable(java.lang.String name,
CDFDataType dataType,
java.lang.Object value)
throws CDFException.WriterError
name - variable namedataType - data typevalue - data valueCDFException.WriterError - if there is an errorpublic void addNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.Object value)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionsvalue - data valueCDFException.WriterError - if there is an errorpublic void addNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size,
java.lang.Object value)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionssize - the number of elementsvalue - data valueCDFException.WriterError - if there is an errorpublic void defineNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionssize - the number of elementsCDFException.WriterError - if there is an errorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionsvarys - dimension variancerecordVariance - record variancecompressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padCDFException.WriterError - if there is an errorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
SparseRecordOption option)
throws CDFException.WriterError
name - variable namedataType - data typedim - dimensionsvarys - dimension variancerecordVariance - record variancecompressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padoption - sparse record optionCDFException.WriterError - if there is an errorpublic void defineStringVariable(java.lang.String name,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size)
throws CDFException.WriterError
name - variable namedim - dimensionsvarys - dimension variancerecordVariance - record variancecompressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padsize - length of character stringCDFException.WriterError - if there is an errordefineStringVariable(String name, int[] dim,
boolean[] varys, boolean recordVariance, boolean compressed,
Object pad, int size, SparseRecordOption option)public void defineStringVariable(java.lang.String name,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size,
SparseRecordOption option)
throws CDFException.WriterError
name - variable namedim - dimensionsvarys - dimension variancerecordVariance - record variancecompressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padsize - length of character stringoption - sparse record optionCDFException.WriterError - if there is an errorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size)
throws CDFException.WriterError
name - variable namedataType - variable data typedim - dimensionsvarys - dimension variancerecordVariance - record variancecompressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padsize - length of character stringCDFException.WriterError - if there is an errorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size,
SparseRecordOption option)
throws CDFException.WriterError
name - Variable namedataType - data type of the variabledim - dimensionvarys - dimension varyingrecordVariance - record variancecompressed - whether the variable data appears in compressed
form in the CDFpad - Object to use as a pad value - a Number object
for a numeric variable, a String for a character
variablesize - length of charater string for character variable,
Must be 1 for numeric type variableoption - sparse record optionCDFException.WriterError - if there is an errorpublic void addOneD(java.lang.String name,
java.lang.Object data)
throws CDFException.WriterError
name - name of the variable.data - a one dimensional array of a type compatible with
the type of variable.CDFException.WriterError - if there is an erroraddOneD(String name, Object data, int[] recordRange, boolean relax)public void addOneD(java.lang.String name,
java.lang.Object data,
boolean relax)
throws CDFException.WriterError
name - name of the variable.data - a one dimensional array of a type compatible with
the type of variable.relax - relevant for unsigned data types, CDF_UINT1,
CDF_UINT2 and CDF_UINT4 only,specifies that values in
data array can be interpreted as unsigned.CDFException.WriterError - if there is an erroraddOneD(String name, Object data, int[] recordRange, boolean relax)public void addOneD(java.lang.String name,
java.lang.Object data,
int[] recordRange)
throws CDFException.WriterError
name - name of the variable.data - a one dimensional array of a type compatible with
the type of variable.recordRange - int[2] containing record range. May be null, in
which case range is assumed to be follow last record added.CDFException.WriterError - if there is an erroraddOneD(String name, Object data, int[] recordRange, boolean relax)public void addOneD(java.lang.String name,
java.lang.Object data,
int[] recordRange,
boolean relax)
throws CDFException.WriterError
name - name of the variable.data - a one dimensional array of a type compatible with
the type of variable.recordRange - int[2] containing record range. May be null, in
which case range is assumed to be follow last record added.relax - relevant for unsigned data types, CDF_UINT1,
CDF_UINT2 and CDF_UINT4 only,specifies that values in
data array can be interpreted as unsigned.
| CDF Type of Variable | Type of Array |
| INT8, TT2000, UINT4 | long |
| UINT4 | int, if relax = true, long otherwise |
| DOUBLE, EPOCH, EPOCH16 | double |
| FLOAT | float or double |
| INT4 | int |
| UINT2 | short, if relax = true, int otherwise |
| INT2 | short |
| UINT1 | byte, if relax = true, short otherwise |
| INT1 | byte |
| CHAR | String |
CDFException.WriterError - if there is an errorpublic void addData(java.lang.String name,
java.lang.Object data)
throws CDFException.WriterError
name - name of the variable.data - an array of type compatible with the type of variable.CDFException.WriterError - if there is an erroraddData(String name, Object data, boolean relax)public void addData(java.lang.String name,
java.lang.Object data,
boolean relax)
throws CDFException.WriterError
name - name of the variable.data - an array of type compatible with the type of variable.relax - relevant for unsigned data types, CDF_UINT1,
CDF_UINT2 and CDF_UINT4 only,specifies that values in
data array can be interpreted as unsigned.CDFException.WriterError - if there is an errorfor more details.public void addData(java.lang.String name,
java.lang.Object data,
int[] recordRange)
throws CDFException.WriterError
name - name of the variable.data - an array of type compatible with the type of variable, or
a ByteOrder.LITTLE_ENDIAN ByteBuffer containing data to be added.recordRange - int[2] containing record range. If data is an
array, or variable is to be saved uncompressed, recordRange may be null,
in which case range is assumed to be follow last record added.CDFException.WriterError - if there is an erroraddData(String name, Object data, int[] recordRange, boolean relax)public void addData(java.lang.String name,
java.lang.Object data,
int[] recordRange,
boolean relax)
throws CDFException.WriterError
name - name of the variable.data - an array of type compatible with the type of variable, or
a ByteOrder.LITTLE_ENDIAN ByteBuffer containing data to be added.recordRange - int[2] containing record range. If data is an
array, or variable is to be saved uncompressed, recordRange may be null,
in which case range is assumed to be follow last record added.relax - relevant for unsigned data types, CDF_UINT1,
CDF_UINT2 and CDF_UINT4 only,specifies that values in
data array can be interpreted as unsigned.
| CDF Type of Variable | Type of Array |
| INT8, TT2000, UINT4 | long |
| UINT4 | int, if relax = true, long otherwise |
| DOUBLE, EPOCH, EPOCH16 | double |
| FLOAT | float or double |
| INT4 | int |
| UINT2 | short, if relax = true, int otherwise |
| INT2 | short |
| UINT1 | byte, if relax = true, short otherwise |
| INT1 | byte |
| CHAR | String |
CDFException.WriterError - if there is an errorpublic void setMD5Needed(boolean need)
need - A flag indicating whether to apply md5 checksum to the filepublic void write(java.lang.String fname)
throws java.io.IOException
fname - the output CDF file namejava.io.IOException - if there is an errorpublic boolean write(java.lang.String fname,
boolean overwrite)
throws java.io.IOException
fname - the output CDF file nameoverwrite - the flag indicating whether to overwrite an exisitng CDFjava.io.IOException - if there is an errorpublic void setLastLeapSecondId(int n)
n - integer = year*10000 + month*100 + day, where year
month and day refer to the day following the leap second.
A 0 value for n asserts that applications accept the
validity of TT2000 times. n = -1 implies lastLeapSecondId=20120701,
which is the default for CDF versions prior to 3.6.