ucar.nc2.iosp
Interface LayoutBB

All Superinterfaces:
Layout
All Known Implementing Classes:
LayoutBBTiled

public interface LayoutBB
extends Layout

A Layout that supplies the "source" ByteBuffer. This is used when the data must be massaged after being read, eg uncompresed or filtered. The modified data is placed in a ByteBuffer, which may change for different chunks, and so is supplied by each chunk.

Example for Integers:


  int[] read( LayoutBB index, int[] pa) {
      while (index.hasNext()) {
        LayoutBB.Chunk chunk = index.next();
        IntBuffer buff = chunk.getIntBuffer();
        buff.position(chunk.getSrcElem());
        int pos = (int) chunk.getDestElem();
        for (int i = 0; i < chunk.getNelems(); i++)
          pa[pos++] = buff.get();
      }
      return pa;
  }

 

Since:
Jan 9, 2008
Author:
caron

Nested Class Summary
static interface LayoutBB.Chunk
          A chunk of data that is contiguous in both the source and destination.
 
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
 

Method Detail

getTotalNelems

long getTotalNelems()
Get total number of elements in the wanted subset.

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

getElemSize

int getElemSize()
Get size of each element in bytes.

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

hasNext

boolean hasNext()
Is there more to do

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

next

LayoutBB.Chunk next()
                    throws IOException
Get the next chunk

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


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