ucar.nc2.iosp
Class Indexer
java.lang.Object
ucar.nc2.iosp.Indexer
- Direct Known Subclasses:
- RegularIndexer, RegularLayout, RegularSectionLayout, SegmentedLayout, SingleChunkIndexer
Deprecated. use Layout
public abstract class Indexer
- extends java.lang.Object
Iterator to read/write subsets of an array.
The transfer is broken into "chunks" that are contiguous in both the source and destination.
Iterating over all the chunks should give the wanted section of data. However, there may be
missing values, so the caller cant count on all elements getting touched.
Example for Integers:
Reading:
int[] pa = new int[size];
Indexer index;
while (index.hasNext()) {
Indexer.Chunk chunk = index.next();
raf.seek ( chunk.getFilePos());
raf.readInt( pa, chunk.getStartElem(), chunk.getNelems()); // copy into primitive array
}
Writing:
IndexIterator ii = values.getIndexIterator();
while (index.hasNext()) {
Indexer.Chunk chunk = index.next();
raf.seek ( chunk.getFilePos());
for (int k=0; k
|
Nested Class Summary |
class |
Indexer.Chunk
Deprecated. A chunk of data that is contiguous in both the source and destination. |
|
Constructor Summary |
Indexer()
Deprecated. |
|
Method Summary |
abstract int |
getElemSize()
Deprecated. |
abstract long |
getTotalNelems()
Deprecated. |
abstract boolean |
hasNext()
Deprecated. |
abstract Indexer.Chunk |
next()
Deprecated. Get the next chunk |
protected java.lang.String |
printa(int[] a)
Deprecated. |
protected void |
printa(java.lang.String name,
int[] a)
Deprecated. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Indexer
public Indexer()
- Deprecated.
getTotalNelems
public abstract long getTotalNelems()
- Deprecated.
- Returns:
- total number of elements in the wanted subset.
getElemSize
public abstract int getElemSize()
- Deprecated.
- Returns:
- size of each element in bytes.
hasNext
public abstract boolean hasNext()
- Deprecated.
- Returns:
- true if theres more to do
next
public abstract Indexer.Chunk next()
throws java.io.IOException
- Deprecated.
- Get the next chunk
- Returns:
- next chunk, or null if !hasNext()
- Throws:
java.io.IOException - on i/o error
printa
protected java.lang.String printa(int[] a)
- Deprecated.
printa
protected void printa(java.lang.String name,
int[] a)
- Deprecated.