|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectucar.nc2.iosp.AbstractIOServiceProvider
ucar.nc2.iosp.netcdf3.N3iosp
public abstract class N3iosp
IOServiceProvider implementation abstract base class to read/write "version 3" netcdf files. AKA "file format version 1" files.
concrete class| Field Summary | |
|---|---|
protected boolean |
debug
|
protected boolean |
debugRecord
|
protected boolean |
debugSize
|
protected boolean |
debugSPIO
|
protected boolean |
debugSync
|
protected HashMap |
dimHash
|
protected boolean |
fill
|
static String |
FillValue
|
protected N3header |
header
|
protected long |
lastModified
|
static int |
MAX_NUMRECS
The maximum number of records is 2^32-1. |
static long |
MAX_VARSIZE
Each fixed-size variable and the data for one record's worth of a single record variable are limited to a little less than 4 GiB. |
static byte |
NC_FILL_BYTE
|
static char |
NC_FILL_CHAR
|
static double |
NC_FILL_DOUBLE
|
static float |
NC_FILL_FLOAT
|
static int |
NC_FILL_INT
|
static long |
NC_FILL_LONG
|
static short |
NC_FILL_SHORT
|
protected NetcdfFile |
ncfile
|
protected boolean |
readonly
|
protected boolean |
showHeaderBytes
|
protected boolean |
useRecordStructure
|
| Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider |
|---|
raf |
| Constructor Summary | |
|---|---|
N3iosp()
|
|
| Method Summary | |
|---|---|
protected abstract void |
_create(RandomAccessFile raf)
|
protected abstract void |
_open(RandomAccessFile raf)
|
void |
close()
Close the file. |
protected static char[] |
convertByteToCharUTF(byte[] byteArray)
|
protected static byte[] |
convertCharToByteUTF(char[] from)
|
void |
create(String filename,
NetcdfFile ncfile,
int extra,
long preallocateSize,
boolean largeFile)
Create new file, populate it from the objects in ncfile. |
static String |
createValidNetcdf3ObjectName(String name)
Convert a name to a legal netcdf name. |
protected void |
fillNonRecordVariables()
|
protected void |
fillRecordVariables(int recStart,
int recEnd)
|
void |
flush()
Flush all data buffers to disk. |
String |
getDetailInfo()
Show debug / underlying implementation details |
String |
getFileTypeDescription()
Get a human-readable description for this file type. |
String |
getFileTypeId()
Get a unique id for this file type. |
static Pattern |
getValidNetcdf3ObjectNamePattern()
Valid Netcdf Object name as a regular expression. |
boolean |
isValidFile(RandomAccessFile raf)
Check if this is a valid file for this IOServiceProvider. |
static boolean |
isValidNetcdf3ObjectName(String name)
Determine if the given name can be used for a Dimension, Attribute, or Variable name. |
static String |
makeValidNetcdfObjectName(String name)
Convert a name to a legal netcdf-3 name. |
static String |
makeValidNetcdfObjectNameOld(String name)
|
void |
open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
Open existing file, and populate ncfile with it. |
protected abstract Object |
readData(Layout index,
DataType dataType)
Read data subset from file for a variable, create primitive array. |
protected abstract long |
readData(Layout index,
DataType dataType,
WritableByteChannel out)
|
Array |
readData(Variable v2,
Section section)
Read data from a top level Variable and return a memory resident Array. |
Array |
readNestedData(Variable v2,
Section section)
|
long |
readToByteChannel(Variable v2,
Section section,
WritableByteChannel channel)
Read data from a top level Variable and send data to a WritableByteChannel. |
boolean |
rewriteHeader(boolean largeFile)
|
Object |
sendIospMessage(Object message)
A way to communicate arbitrary information to an iosp. |
void |
setFill(boolean fill)
Set the fill flag. |
protected void |
setNumrecs(int n)
|
static void |
setProperty(String name,
String value)
Set a static property. |
boolean |
sync()
Update the metadata in the NetcdfFile if the underlying dataset has changed. |
boolean |
syncExtend()
Extend the NetcdfFile if the underlying dataset has changed in a way that is compatible with the current metadata. |
String |
toStringDebug(Object o)
Debug info for this object. |
void |
updateAttribute(Variable v2,
Attribute att)
Update the value of an existing attribute. |
protected abstract void |
writeData(Array aa,
Layout index,
DataType dataType)
Write data subset to file for a variable, create primitive array. |
void |
writeData(Variable v2,
Section section,
Array values)
Write data into a variable. |
| Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider |
|---|
createValidNetcdfObjectName, getFileTypeVersion, getStructureIterator, readSection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ucar.nc2.iosp.IOServiceProvider |
|---|
getFileTypeVersion, getStructureIterator, readSection |
| Field Detail |
|---|
public static final byte NC_FILL_BYTE
public static final char NC_FILL_CHAR
public static final short NC_FILL_SHORT
public static final int NC_FILL_INT
public static final long NC_FILL_LONG
public static final float NC_FILL_FLOAT
public static final double NC_FILL_DOUBLE
public static final String FillValue
public static final long MAX_VARSIZE
public static final int MAX_NUMRECS
protected NetcdfFile ncfile
protected boolean readonly
protected N3header header
protected long lastModified
protected boolean debug
protected boolean debugSize
protected boolean debugSPIO
protected boolean debugRecord
protected boolean debugSync
protected boolean showHeaderBytes
protected boolean useRecordStructure
protected boolean fill
protected HashMap dimHash
| Constructor Detail |
|---|
public N3iosp()
| Method Detail |
|---|
public static void setProperty(String name,
String value)
name - property namevalue - property valuepublic static String makeValidNetcdfObjectName(String name)
name - convert this name
public static String makeValidNetcdfObjectNameOld(String name)
public static boolean isValidNetcdf3ObjectName(String name)
name - test this.
public static Pattern getValidNetcdf3ObjectNamePattern()
public static String createValidNetcdf3ObjectName(String name)
name - convert this name
public boolean isValidFile(RandomAccessFile raf)
throws IOException
IOServiceProvider
isValidFile in interface IOServiceProviderraf - RandomAccessFile
IOException - if read errorpublic String getDetailInfo()
IOServiceProvider
getDetailInfo in interface IOServiceProvidergetDetailInfo in class AbstractIOServiceProvider
public void open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
throws IOException
IOServiceProvider
open in interface IOServiceProvideropen in class AbstractIOServiceProviderraf - the file to work on, it has already passed the isValidFile() test.ncfile - add objects to this empty NetcdfFilecancelTask - used to monitor user cancellation; may be null.
IOException - if read errorpublic void setFill(boolean fill)
IOServiceProviderWriter
setFill in interface IOServiceProviderWriterfill - set fill mode true or false
public Array readData(Variable v2,
Section section)
throws IOException,
InvalidRangeException
IOServiceProvider
readData in interface IOServiceProviderv2 - a top-level Variablesection - the section of data to read.
There must be a Range for each Dimension in the variable, in order.
Note: no nulls allowed. IOSP may not modify.
IOException - if read error
InvalidRangeException - if invalid sectionRange
public Array readNestedData(Variable v2,
Section section)
throws IOException,
InvalidRangeException
IOException
InvalidRangeException
public long readToByteChannel(Variable v2,
Section section,
WritableByteChannel channel)
throws IOException,
InvalidRangeException
IOServiceProvider
readToByteChannel in interface IOServiceProviderreadToByteChannel in class AbstractIOServiceProviderv2 - a top-level Variablesection - the section of data to read.
There must be a Range for each Dimension in the variable, in order.
Note: no nulls allowed. IOSP may not modify.channel - write data to this WritableByteChannel
IOException - if read error
InvalidRangeException - if invalid sectionprotected static char[] convertByteToCharUTF(byte[] byteArray)
protected static byte[] convertCharToByteUTF(char[] from)
public void create(String filename,
NetcdfFile ncfile,
int extra,
long preallocateSize,
boolean largeFile)
throws IOException
IOServiceProviderWriter
create in interface IOServiceProviderWriterfilename - name of file to create.ncfile - get dimensions, attributes, and variables from here.extra - if > 0, pad header with extra bytespreallocateSize - if > 0, set length of file to this upon creation - this (usually) pre-allocates contiguous storage.largeFile - if want large file format
IOException - if I/O error
public boolean rewriteHeader(boolean largeFile)
throws IOException
rewriteHeader in interface IOServiceProviderWriterIOException
public void writeData(Variable v2,
Section section,
Array values)
throws IOException,
InvalidRangeException
IOServiceProviderWriter
writeData in interface IOServiceProviderWriterv2 - variable to write; must already exist.section - the section of data to write.
There must be a Range for each Dimension in the variable, in order.
The shape must match the shape of values.
The origin and stride indicate where the data is placed into the stored Variable array.values - data to write. The shape must match section.getShape().
IOException - if I/O error
InvalidRangeException - if invalid section
protected void setNumrecs(int n)
throws IOException,
InvalidRangeException
IOException
InvalidRangeException
public void updateAttribute(Variable v2,
Attribute att)
throws IOException
updateAttribute in interface IOServiceProviderWriterv2 - variable, or null for fglobal attributeatt - replace with this value
IOException
protected void fillNonRecordVariables()
throws IOException
IOException
protected void fillRecordVariables(int recStart,
int recEnd)
throws IOException,
InvalidRangeException
IOException
InvalidRangeException
public boolean syncExtend()
throws IOException
IOServiceProvider
syncExtend in interface IOServiceProvidersyncExtend in class AbstractIOServiceProviderIOException - if a read error occured when accessing the underlying dataset.
public boolean sync()
throws IOException
IOServiceProvider
sync in interface IOServiceProvidersync in class AbstractIOServiceProviderIOException - if a read error occured when accessing the underlying dataset.
public void flush()
throws IOException
IOServiceProviderWriter
flush in interface IOServiceProviderWriterIOException - if I/O error
public void close()
throws IOException
IOServiceProvider
close in interface IOServiceProviderclose in class AbstractIOServiceProviderIOException - if read errorpublic String toStringDebug(Object o)
toStringDebug in interface IOServiceProvidertoStringDebug in class AbstractIOServiceProvidero - which object
public Object sendIospMessage(Object message)
IOServiceProvider
sendIospMessage in interface IOServiceProvidersendIospMessage in class AbstractIOServiceProvidermessage - opaque message.
public String getFileTypeId()
IOServiceProvider
getFileTypeId in interface IOServiceProviderpublic String getFileTypeDescription()
IOServiceProvider
getFileTypeDescription in interface IOServiceProvider
protected abstract Object readData(Layout index,
DataType dataType)
throws IOException
index - handles skipping around in the file.dataType - dataType of the variable
IOException - on error
protected abstract long readData(Layout index,
DataType dataType,
WritableByteChannel out)
throws IOException
IOException
protected abstract void writeData(Array aa,
Layout index,
DataType dataType)
throws IOException
aa - write data in this Array.index - handles skipping around in the file.dataType - dataType of the variable
IOException - on error
protected abstract void _open(RandomAccessFile raf)
throws IOException
IOException
protected abstract void _create(RandomAccessFile raf)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||