ucar.netcdf
Class NetcdfFile.V1Io

java.lang.Object
  extended byucar.multiarray.AbstractAccessor
      extended byucar.netcdf.NetcdfFile.V1Io
All Implemented Interfaces:
Accessor
Enclosing class:
NetcdfFile

abstract class NetcdfFile.V1Io
extends AbstractAccessor


Field Summary
(package private)  int begin
           
(package private)  int[] dsizes
           
(package private)  byte[] fillbytes
           
(package private)  boolean isUnlimited
           
(package private)  int vsize
           
(package private)  int xsz
           
 
Constructor Summary
protected NetcdfFile.V1Io(ProtoVariable proto)
           
 
Method Summary
 void checkfill(int newLength)
           
(package private)  long computeOffset(int[] origin)
           
 void copyin(int[] origin, MultiArray data)
          You almost always want to override this
 void copyin(int[] origin, MultiArrayImpl data)
           
 MultiArray copyout(int[] origin, int[] shape)
          Aggregate read access.
(package private) abstract  void fill(DataOutput dos, int nbytes, Attribute fAttr)
           
(package private)  void fill(int recno)
           
(package private)  void fillO(long offset)
           
(package private)  int getRank()
           
(package private)  boolean isScalar()
           
(package private) abstract  void readArray(long offset, Object dst, int dst_position, int nelems)
           
 Object toArray()
          Returns a new array containing all of the elements in this MultiArray.
 Object toArray(Object dst, int[] origin, int[] shape)
          Returns an array containing elements of this MultiArray specified by origin and shape, possibly converting the component type.
(package private) abstract  void writeArray(long offset, Object from, int begin, int nelems)
           
 
Methods inherited from class ucar.multiarray.AbstractAccessor
copy, copyO, get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getShort, set, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fillbytes

byte[] fillbytes

vsize

int vsize

begin

int begin

isUnlimited

final boolean isUnlimited

dsizes

final int[] dsizes

xsz

int xsz
Constructor Detail

NetcdfFile.V1Io

protected NetcdfFile.V1Io(ProtoVariable proto)
Method Detail

readArray

abstract void readArray(long offset,
                        Object dst,
                        int dst_position,
                        int nelems)
                 throws IOException
Throws:
IOException

copyout

public MultiArray copyout(int[] origin,
                          int[] shape)
                   throws IOException
Description copied from interface: Accessor
Aggregate read access. Return a new MultiArray of the same componentType as this, and with shape as specified, which is initialized to the values of this, as clipped to (origin, origin + shape).

It is easier to implement than to specify :-).

The main reason to implement this instead of using the equivalent proxy is for remote or file access.

assert(origin[ii] + shape[ii] <= lengths[ii]);

Specified by:
copyout in interface Accessor
Specified by:
copyout in class AbstractAccessor
Throws:
IOException

writeArray

abstract void writeArray(long offset,
                         Object from,
                         int begin,
                         int nelems)
                  throws IOException
Throws:
IOException

copyin

public void copyin(int[] origin,
                   MultiArray data)
            throws IOException
Description copied from class: AbstractAccessor
You almost always want to override this

Specified by:
copyin in interface Accessor
Overrides:
copyin in class AbstractAccessor
Throws:
IOException

copyin

public void copyin(int[] origin,
                   MultiArrayImpl data)
            throws IOException
Throws:
IOException

toArray

public Object toArray()
               throws IOException
Description copied from interface: Accessor
Returns a new array containing all of the elements in this MultiArray. The returned array is one dimensional. The order of the elements in the result is natural, as if we used an IndexIterator to step through the elements of this MultiArray. The component type of the result is the same as this.

This method acts as bridge between array-based and MultiArray-based APIs.

This method is functionally equivalent to

                Object anArray = Array.newInstance(getComponentType(), 1);
                int [] origin = new int[getRank()]
                int [] shape = getDimensions();
                return toArray(anArray, origin, shape);
 

Specified by:
toArray in interface Accessor
Specified by:
toArray in class AbstractAccessor
Throws:
IOException

toArray

public Object toArray(Object dst,
                      int[] origin,
                      int[] shape)
               throws IOException
Description copied from interface: Accessor
Returns an array containing elements of this MultiArray specified by origin and shape, possibly converting the component type. The returned array is one dimensional. The order of the elements in the result is natural, as if we used an IndexIterator to step through the elements of this MultiArray.

The anArray argument should be an array. If it is large enough to contain the output, it is used and no new storage is allocated. Otherwise, new storage is allocated with the same component type as the argument, and the data is copied into it.

This method acts as bridge between array-based and MultiArray-based APIs.

This method is similar to copyout(origin, shape).toArray(), but avoids a copy operation and (potentially) an allocation.

NOTE: Implementation of type conversion is deferred until JDK 1.2. Currently, the componentType of anArray must be the same as this

Specified by:
toArray in interface Accessor
Specified by:
toArray in class AbstractAccessor
Throws:
IOException

checkfill

public final void checkfill(int newLength)
                     throws IOException
Throws:
IOException

getRank

final int getRank()

isScalar

final boolean isScalar()

computeOffset

final long computeOffset(int[] origin)

fill

abstract void fill(DataOutput dos,
                   int nbytes,
                   Attribute fAttr)
            throws IOException
Throws:
IOException

fillO

void fillO(long offset)
     throws IOException
Throws:
IOException

fill

void fill(int recno)
    throws IOException
Throws:
IOException