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
dimensions.
|
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) |
public GenericWriter()
public GenericWriter(boolean rowMajority)
public 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.WriterErrorpublic 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.WriterErrorpublic 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.WriterErrorpublic 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.WriterErrorpublic 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.WriterErrorpublic 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.WriterErrorpublic boolean hasTimeVariable(java.lang.String name)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineTimeVariable(java.lang.String name,
CDFTimeType timeType)
throws CDFException.WriterError
time type.CDFException.WriterErrorpublic void defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineCompressedTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname,
CDFTimeType timeType)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineTimeSeries(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.String tname,
CDFTimeType timeType,
boolean compressed)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineStringVariable(java.lang.String name,
int[] dim,
int size)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineCompressedVariable(java.lang.String name,
CDFDataType dataType,
int[] dim)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineCompressedStringVariable(java.lang.String name,
int[] dim,
int size)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineCompressedVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
throws CDFException.WriterError
CDFException.WriterErrorpublic void addNRVString(java.lang.String name,
java.lang.String value)
throws CDFException.WriterError
CDFException.WriterErrorpublic void addNRVVariable(java.lang.String name,
CDFDataType dataType,
java.lang.Object value)
throws CDFException.WriterError
CDFException.WriterErrorpublic void addNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
java.lang.Object value)
throws CDFException.WriterError
CDFException.WriterErrorpublic void addNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size,
java.lang.Object value)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineNRVVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
int size)
throws CDFException.WriterError
CDFException.WriterErrorpublic void defineVariable(java.lang.String name,
CDFDataType dataType,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad)
throws CDFException.WriterError
name - dataType - data tpedim - dimensionsvarys - dimension variancerecordVariance - compressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padCDFException.WriterErrorpublic 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 - dataType - data tpedim - dimensionsvarys - dimension variancerecordVariance - compressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padoption - sparse record optionCDFException.WriterErrorpublic void defineStringVariable(java.lang.String name,
int[] dim,
boolean[] varys,
boolean recordVariance,
boolean compressed,
java.lang.Object pad,
int size)
throws CDFException.WriterError
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 - dim - dimensionsvarys - dimension variancerecordVariance - compressed - 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.WriterErrorpublic 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 - dim - dimensionsvarys - dimension variancerecordVariance - compressed - whether the values will be saved in compressed formpad - array or wrapped scalar value to assign to use as padsize - length of character stringCDFException.WriterErrorpublic 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 - recordVariance - compressed - 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.WriterErrorpublic void addOneD(java.lang.String name,
java.lang.Object data)
throws CDFException.WriterError
public void addOneD(java.lang.String name,
java.lang.Object data,
boolean relax)
throws CDFException.WriterError
public void addOneD(java.lang.String name,
java.lang.Object data,
int[] recordRange)
throws CDFException.WriterError
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.WriterErrorpublic void addData(java.lang.String name,
java.lang.Object data)
throws CDFException.WriterError
CDFException.WriterErroraddData(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.WriterErrorfor 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.WriterErroraddData(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.WriterErrorpublic void setMD5Needed(boolean need)
public void write(java.lang.String fname)
throws java.io.IOException
java.io.IOExceptionpublic boolean write(java.lang.String fname,
boolean overwrite)
throws java.io.IOException
java.io.IOExceptionpublic 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.