clcommon/src/main/java/ucar/nc2/iosp/fysat/Fysatiosp.java
private Array readData(ucar.nc2.Variable v2, long dataPos, int[] origin, int[] shape, int[] stride) throws IOException, InvalidRangeException {

    // long length = myRaf.length();
    raf.seek(dataPos);
    Vinfo vi = (Vinfo) v2.getSPobject();
    int data_size = vi.vsize;
    byte[] data = new byte[data_size];
    raf.readFully(data);

    Array array;
    if (vi.classType == DataType.BYTE.getPrimitiveClassType()) {

      array = Array.factory(DataType.BYTE, v2.getShape(), data);
    } else if (vi.classType == DataType.SHORT.getPrimitiveClassType()) {
      EndianByteBuffer byteBuff = new EndianByteBuffer(data, vi.byteOrder);
      short[] sdata = byteBuff.getShortArray();
      //for(int i=0; i<sdata.length; i++){
      //	System.out.println(sdata[i]);
      //}
      array = Array.factory(DataType.SHORT, v2.getShape(), sdata);
    } else if (vi.classType == DataType.INT.getPrimitiveClassType()) {
      EndianByteBuffer byteBuff = new EndianByteBuffer(data, vi.byteOrder);
      short[] idata = byteBuff.getShortArray();
      array = Array.factory(DataType.INT, v2.getShape(), idata);

    } else {
      throw new UnsupportedEncodingException();
    }

    return array.sectionNoReduce(origin, shape, stride);

  }
private Array readData(ucar.nc2.Variable v2, long dataPos, int[] origin, int[] shape, int[] stride) throws IOException, InvalidRangeException {

    // long length = myRaf.length();
    raf.seek(dataPos);
    Vinfo vi = (Vinfo) v2.getSPobject();
    int data_size = vi.vsize;
    byte[] data = new byte[data_size];
    raf.readFully(data);

    Array array;
    if (vi.classType == DataType.BYTE.getPrimitiveClassType()) {

      array = Array.factory(DataType.BYTE, v2.getShape(), data);
    } else if (vi.classType == DataType.SHORT.getPrimitiveClassType()) {
      EndianByteBuffer byteBuff = new EndianByteBuffer(data, vi.byteOrder);
      short[] sdata = byteBuff.getShortArray();
      //for(int i=0; i<sdata.length; i++){
      //	System.out.println(sdata[i]);
      //}
      array = Array.factory(DataType.SHORT, v2.getShape(), sdata);
    } else if (vi.classType == DataType.INT.getPrimitiveClassType()) {
      EndianByteBuffer byteBuff = new EndianByteBuffer(data, vi.byteOrder);
      short[] idata = byteBuff.getShortArray();
      array = Array.factory(DataType.INT, v2.getShape(), idata);

    } else {
      throw new UnsupportedEncodingException();
    }

    return array.sectionNoReduce(origin, shape, stride);

  }
private Array readData ( ucar . nc2 . Variable v2 , long dataPos , int [ ] origin , int [ ] shape , int [ ] stride ) throws IOException , InvalidRangeException { // long length = myRaf.length(); raf . seek ( dataPos ) ; Vinfo vi = ( Vinfo ) v2 . getSPobject ( ) ; int data_size = vi . vsize ; byte [ ] data = new byte [ data_size ] ; raf . readFully ( data ) ; Array array ; if ( vi . classType == DataType . BYTE . getPrimitiveClassType ( ) ) { array = Array . factory ( DataType . BYTE , v2 . getShape ( ) , data ) ; } else if ( vi . classType == DataType . SHORT . getPrimitiveClassType ( ) ) { EndianByteBuffer byteBuff = new EndianByteBuffer ( data , vi . byteOrder ) ; short [ ] sdata = byteBuff . getShortArray ( ) ; //for(int i=0; i<sdata.length; i++){ //	System.out.println(sdata[i]); //} array = Array . factory ( DataType . SHORT , v2 . getShape ( ) , sdata ) ; } else if ( vi . classType == DataType . INT . getPrimitiveClassType ( ) ) { EndianByteBuffer byteBuff = new EndianByteBuffer ( data , vi . byteOrder ) ; short [ ] idata = byteBuff . getShortArray ( ) ; array = Array . factory ( DataType . INT , v2 . getShape ( ) , idata ) ; } else { throw new UnsupportedEncodingException ( ) ; } return array . sectionNoReduce ( origin , shape , stride ) ; }
all the work is here, so can be called recursively
all the work is here so can be called recursively