ucar.nc2.iosp
Class LayoutBBTiled

java.lang.Object
  extended by ucar.nc2.iosp.LayoutBBTiled
All Implemented Interfaces:
Layout, LayoutBB

public class LayoutBBTiled
extends Object
implements LayoutBB

For datasets where the data are stored in chunks, and must be processed, eg compressed or filtered. The data is read, processed, and placed in a ByteBuffer. Chunks have an offset into the ByteBuffer. "Tiled" means that all chunks are assumed to be equal size. Chunks do not necessarily cover the array, missing data is possible.

Since:
Jan 9, 2008
Author:
caron

Nested Class Summary
static interface LayoutBBTiled.DataChunk
          A data chunk
static interface LayoutBBTiled.DataChunkIterator
          An iterator over the data chunks.
 
Constructor Summary
LayoutBBTiled(LayoutBBTiled.DataChunkIterator chunkIterator, int[] chunkSize, int elemSize, Section wantSection)
          Constructor.
 
Method Summary
 int getElemSize()
          Get size of each element in bytes.
 long getTotalNelems()
          Get total number of elements in the wanted subset.
 boolean hasNext()
          Is there more to do
 LayoutBB.Chunk next()
          Get the next chunk
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayoutBBTiled

public LayoutBBTiled(LayoutBBTiled.DataChunkIterator chunkIterator,
                     int[] chunkSize,
                     int elemSize,
                     Section wantSection)
              throws InvalidRangeException,
                     IOException
Constructor.

Parameters:
chunkIterator - iterator over all data chunks
chunkSize - all chunks assumed to be the same size
elemSize - size of an element in bytes.
wantSection - the wanted section of data, contains a List of Range objects. Must be complete.
Throws:
InvalidRangeException - if section invalid for this variable
IOException - on io error
Method Detail

getTotalNelems

public long getTotalNelems()
Description copied from interface: LayoutBB
Get total number of elements in the wanted subset.

Specified by:
getTotalNelems in interface Layout
Specified by:
getTotalNelems in interface LayoutBB
Returns:
total number of elements in the wanted subset.

getElemSize

public int getElemSize()
Description copied from interface: LayoutBB
Get size of each element in bytes.

Specified by:
getElemSize in interface Layout
Specified by:
getElemSize in interface LayoutBB
Returns:
size of each element in bytes.

hasNext

public boolean hasNext()
Description copied from interface: LayoutBB
Is there more to do

Specified by:
hasNext in interface Layout
Specified by:
hasNext in interface LayoutBB
Returns:
true if theres more to do

next

public LayoutBB.Chunk next()
                    throws IOException
Description copied from interface: LayoutBB
Get the next chunk

Specified by:
next in interface Layout
Specified by:
next in interface LayoutBB
Returns:
next chunk, or null if !hasNext()
Throws:
IOException - on i/o error

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.