int nbytes = 0; for (int j = 0; j < nelems; j++) nbytes += readAttributeValue(dtype, ii);
private long findAtt(long start_pos, String want) throws IOException { raf.seek(start_pos + 4); int natts = raf.readInt(); for (int i = 0; i < natts; i++) { String name = readString(); if (name.equals(want)) return raf.getFilePointer(); int type = raf.readInt(); if (type == 2) { readString(); } else { int nelems = raf.readInt(); DataType dtype = getDataType(type); int[] shape = {nelems}; Array arr = Array.factory(dtype, shape); IndexIterator ii = arr.getIndexIterator(); int nbytes = 0; for (int j = 0; j < nelems; j++) nbytes += readAttributeValue(dtype, ii); skip(nbytes); } } throw new IllegalArgumentException("no such attribute " + want); }
int nbytes = 0; for (int j = 0; j < nelems; j++) nbytes += readAttributeValue(dtype, ii);
int nbytes = 0; for (int j = 0; j < nelems; j++) nbytes += readAttributeValue(dtype, ii);
private long findAtt(long start_pos, String want) throws IOException { raf.seek(start_pos + 4); int natts = raf.readInt(); for (int i = 0; i < natts; i++) { String name = readString(); if (name.equals(want)) return raf.getFilePointer(); int type = raf.readInt(); if (type == 2) { readString(); } else { int nelems = raf.readInt(); DataType dtype = getDataType(type); int[] shape = {nelems}; Array arr = Array.factory(dtype.getPrimitiveClassType(), shape); IndexIterator ii = arr.getIndexIterator(); int nbytes = 0; for (int j = 0; j < nelems; j++) nbytes += readAttributeValue(dtype, ii); skip(nbytes); } } throw new IllegalArgumentException("no such attribute " + want); }
private long findAtt(long start_pos, String want) throws IOException { raf.seek(start_pos + 4); int natts = raf.readInt(); for (int i = 0; i < natts; i++) { String name = readString(); if (name.equals(want)) return raf.getFilePointer(); int type = raf.readInt(); if (type == 2) { readString(); } else { int nelems = raf.readInt(); DataType dtype = getDataType(type); int[] shape = {nelems}; Array arr = Array.factory(dtype.getPrimitiveClassType(), shape); IndexIterator ii = arr.getIndexIterator(); int nbytes = 0; for (int j = 0; j < nelems; j++) nbytes += readAttributeValue(dtype, ii); skip(nbytes); } } throw new IllegalArgumentException("no such attribute " + want); }