public class Nc4Iosp extends AbstractIOServiceProvider implements IOServiceProviderWriter
raf| Constructor and Description |
|---|
Nc4Iosp(NetcdfFileWriter.Version version) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the file.
|
void |
create(String filename,
NetcdfFile ncfile,
int extra,
long preallocateSize,
boolean largeFile)
Create new file, populate it from the objects in ncfile.
|
void |
flush()
Flush all data buffers to disk.
|
String |
getFileTypeDescription()
Get a human-readable description for this file type.
|
String |
getFileTypeId()
Get a unique id for this file type.
|
static boolean |
isClibraryPresent()
Test if the netcdf C library is present and loaded
|
boolean |
isValidFile(RandomAccessFile raf)
Check if this is a valid file for this IOServiceProvider.
|
static void |
main(String[] args) |
void |
open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
Open existing file, and populate ncfile with it.
|
NetcdfFile |
open(String location) |
Array |
readData(Variable v2,
Section section)
Read data from a top level Variable and return a memory resident Array.
|
boolean |
rewriteHeader(boolean largeFile) |
void |
setChunker(Nc4Chunking chunker) |
void |
setFill(boolean fill)
Set the fill flag.
|
static void |
setLibraryAndPath(String jna_path,
String libname)
set the path and name of the netcdf c library.
|
void |
updateAttribute(Variable v2,
Attribute att)
Update the value of an existing attribute.
|
void |
writeData(Variable v2,
Section section,
Array values)
Write data into a variable.
|
getDetailInfo, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, readToOutputStream, sendIospMessage, streamToByteChannel, sync, syncExtend, toStringDebugclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDetailInfo, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, readToOutputStream, sendIospMessage, streamToByteChannel, sync, syncExtend, toStringDebugpublic Nc4Iosp(NetcdfFileWriter.Version version)
public static boolean isClibraryPresent()
public static void setLibraryAndPath(String jna_path, String libname)
jna_path - pathlibname - library namepublic void setChunker(Nc4Chunking chunker)
public boolean isValidFile(RandomAccessFile raf) throws IOException
IOServiceProviderisValidFile in interface IOServiceProviderraf - RandomAccessFileIOException - if read errorpublic String getFileTypeId()
IOServiceProvidergetFileTypeId in interface IOServiceProviderpublic String getFileTypeDescription()
IOServiceProvidergetFileTypeDescription in interface IOServiceProviderpublic void close()
throws IOException
IOServiceProviderclose in interface IOServiceProviderclose in class AbstractIOServiceProviderIOException - if read errorpublic void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
IOServiceProvideropen 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 Array readData(Variable v2, Section section) throws IOException, InvalidRangeException
IOServiceProviderreadData 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 errorInvalidRangeException - if invalid sectionRangepublic void create(String filename, NetcdfFile ncfile, int extra, long preallocateSize, boolean largeFile) throws IOException
IOServiceProviderWritercreate in interface IOServiceProviderWriterfilename - name of file to create.ncfile - get everything but data from hereextra - 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 formatIOException - if I/O errorpublic void writeData(Variable v2, Section section, Array values) throws IOException, InvalidRangeException
IOServiceProviderWriterwriteData 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 errorInvalidRangeException - if invalid sectionpublic void flush()
throws IOException
IOServiceProviderWriterflush in interface IOServiceProviderWriterIOException - if I/O errorpublic void setFill(boolean fill)
IOServiceProviderWritersetFill in interface IOServiceProviderWriterfill - set fill mode true or falsepublic boolean rewriteHeader(boolean largeFile)
throws IOException
rewriteHeader in interface IOServiceProviderWriterIOExceptionpublic void updateAttribute(Variable v2, Attribute att) throws IOException
IOServiceProviderWriterupdateAttribute in interface IOServiceProviderWriterv2 - variable, or null for global attributeatt - replace with this valueIOException - if I/O errorpublic NetcdfFile open(String location) throws Exception
ExceptionCopyright © 1999-2012 UCAR/Unidata. All Rights Reserved.