Object readDataPrimitive(Layout layout, DataType dataType, int[] shape, Object fillValue, int endian, boolean convertChar) throws java.io.IOException, InvalidRangeException { int size = (int) layout.getTotalNelems(); String[] sa = new String[size]; int count = 0; while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[count++] = headerParser.readHeapString(chunk.getSrcPos() + layout.getElemSize() * i); assert (new Section(shape).computeSize() == layout.getTotalNelems()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; int recsize = layout.getElemSize(); for (int i = 0; i < chunk.getNelems(); i++) { byte[] pa = new byte[recsize];
long count = 0; if ((dataType == DataType.BYTE) || (dataType == DataType.CHAR) || (dataType == DataType.ENUM1)) { while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 2 * chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 4 * chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 8 * chunk.getNelems());
private ArrayStructure convertStructure(Structure s, Layout layout, int[] shape, byte[] byteArray) throws IOException, InvalidRangeException { // create StructureMembers - must set offsets StructureMembers sm = s.makeStructureMembers(); int calcSize = ArrayStructureBB.setOffsets(sm); // standard //ArrayStructureBB.showOffsets(sm, new Indent(2), new Formatter(System.out)); // special offset setting boolean hasHeap = convertStructure(s, sm); //ArrayStructureBB.showOffsets(sm, new Indent(2), new Formatter(System.out)); int recSize = layout.getElemSize(); if (recSize < calcSize) { log.error("calcSize = %d actualSize = %d%n", calcSize, recSize); throw new IOException("H5iosp illegal structure size " + s.getFullName()); } sm.setStructureSize(recSize); // place data into an ArrayStructureBB ByteBuffer bb = ByteBuffer.wrap(byteArray); ArrayStructureBB asbb = new ArrayStructureBB(sm, shape, bb, 0); // strings are stored on the heap, and must be read separately if (hasHeap) { int destPos = 0; for (int i = 0; i < layout.getTotalNelems(); i++) { // loop over each structure convertHeap(asbb, destPos, sm); destPos += layout.getElemSize(); } } return asbb; }
while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readShort(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readInt(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readFloat(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readDouble(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readLong(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); int recsize = index.getElemSize(); byte[] pa = (byte[]) arr; while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem() * recsize, chunk.getNelems() * recsize);
static public Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder, boolean convertChar) throws java.io.IOException { Object arr = (fillValue == null) ? makePrimitiveArray((int) index.getTotalNelems(), dataType) : makePrimitiveArray((int) index.getTotalNelems(), dataType, fillValue); return readData(raf, index, dataType, arr, byteOrder, convertChar); }
while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readShort(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readInt(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readFloat(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readDouble(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readLong(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); int recsize = index.getElemSize(); byte[] pa = (byte[]) arr; while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem() * recsize, chunk.getNelems() * recsize);
long count = 0; if ((dataType == DataType.BYTE) || (dataType == DataType.CHAR) || (dataType == DataType.ENUM1)) { while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 2 * chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 4 * chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 8 * chunk.getNelems());
static public Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder, boolean convertChar) throws java.io.IOException { Object arr = (fillValue == null) ? makePrimitiveArray((int) index.getTotalNelems(), dataType) : makePrimitiveArray((int) index.getTotalNelems(), dataType, fillValue); return readData(raf, index, dataType, arr, byteOrder, convertChar); }
private ArrayStructure convertStructure(Structure s, Layout layout, int[] shape, byte[] byteArray) throws IOException, InvalidRangeException { // create StructureMembers - must set offsets StructureMembers sm = s.makeStructureMembers(); int calcSize = ArrayStructureBB.setOffsets(sm); // standard //ArrayStructureBB.showOffsets(sm, new Indent(2), new Formatter(System.out)); // special offset setting boolean hasHeap = convertStructure(s, sm); //ArrayStructureBB.showOffsets(sm, new Indent(2), new Formatter(System.out)); int recSize = layout.getElemSize(); if (recSize < calcSize) { log.error("calcSize = %d actualSize = %d%n", calcSize, recSize); throw new IOException("H5iosp illegal structure size " + s.getFullName()); } sm.setStructureSize(recSize); // place data into an ArrayStructureBB ByteBuffer bb = ByteBuffer.wrap(byteArray); ArrayStructureBB asbb = new ArrayStructureBB(sm, shape, bb, 0); // strings are stored on the heap, and must be read separately if (hasHeap) { int destPos = 0; for (int i = 0; i < layout.getTotalNelems(); i++) { // loop over each structure convertHeap(asbb, destPos, sm); destPos += layout.getElemSize(); } } return asbb; }
Object readDataPrimitive(Layout layout, DataType dataType, int[] shape, Object fillValue, int endian, boolean convertChar) throws java.io.IOException, InvalidRangeException { int size = (int) layout.getTotalNelems(); String[] sa = new String[size]; int count = 0; while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[count++] = headerParser.readHeapString(chunk.getSrcPos() + layout.getElemSize() * i); assert (new Section(shape).computeSize() == layout.getTotalNelems()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; int recsize = layout.getElemSize(); for (int i = 0; i < chunk.getNelems(); i++) { byte[] pa = new byte[recsize];
while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readShort(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readInt(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readFloat(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readDouble(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.readLong(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems()); int recsize = index.getElemSize(); byte[] pa = (byte[]) arr; while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem() * recsize, chunk.getNelems() * recsize);
long count = 0; if (dataType.getPrimitiveClassType() == byte.class || dataType == DataType.CHAR) { while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 2 * chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 4 * chunk.getNelems()); while (index.hasNext()) { Layout.Chunk chunk = index.next(); count += raf.readToByteChannel( out, chunk.getSrcPos(), 8 * chunk.getNelems());
static public Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder, boolean convertChar) throws java.io.IOException { Object arr = (fillValue == null) ? makePrimitiveArray((int) index.getTotalNelems(), dataType) : makePrimitiveArray((int) index.getTotalNelems(), dataType, fillValue); return readData(raf, index, dataType, arr, byteOrder, convertChar); }
private ArrayStructure convertStructure(Structure s, Layout layout, int[] shape, byte[] byteArray) throws IOException, InvalidRangeException { // create StructureMembers - must set offsets StructureMembers sm = s.makeStructureMembers(); int calcSize = ArrayStructureBB.setOffsets(sm); // standard //ArrayStructureBB.showOffsets(sm, new Indent(2), new Formatter(System.out)); // special offset setting boolean hasHeap = convertStructure(s, sm); //ArrayStructureBB.showOffsets(sm, new Indent(2), new Formatter(System.out)); int recSize = layout.getElemSize(); if (recSize < calcSize) { log.error("calcSize = %d actualSize = %d%n", calcSize, recSize); throw new IOException("H5iosp illegal structure size " + s.getFullName()); } sm.setStructureSize(recSize); // place data into an ArrayStructureBB ByteBuffer bb = ByteBuffer.wrap(byteArray); ArrayStructureBB asbb = new ArrayStructureBB(sm, shape, bb, 0); // strings and vlens are stored on the heap, and must be read separately if (hasHeap) { int destPos = 0; for (int i = 0; i < layout.getTotalNelems(); i++) { // loop over each structure convertHeap(asbb, destPos, sm); destPos += layout.getElemSize(); } } return asbb; }
Object readDataPrimitive(Layout layout, DataType dataType, int[] shape, Object fillValue, int endian, boolean convertChar) throws java.io.IOException, InvalidRangeException { int size = (int) layout.getTotalNelems(); String[] sa = new String[size]; int count = 0; while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[count++] = headerParser.readHeapString(chunk.getSrcPos() + layout.getElemSize() * i); assert (new Section(shape).computeSize() == layout.getTotalNelems()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; int recsize = layout.getElemSize(); for (int i = 0; i < chunk.getNelems(); i++) { byte[] pa = new byte[recsize];
while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos());
if ((dataType == DataType.BYTE) || (dataType == DataType.CHAR)) { IndexIterator ii = values.getIndexIterator(); while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek ( chunk.getSrcPos()); for (int k=0; k<chunk.getNelems(); k++) while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek ( chunk.getSrcPos()); for (int k=0; k<chunk.getNelems(); k++) { while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek ( chunk.getSrcPos()); for (int k=0; k<chunk.getNelems(); k++) while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek ( chunk.getSrcPos()); for (int k=0; k<chunk.getNelems(); k++) while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek ( chunk.getSrcPos()); for (int k=0; k<chunk.getNelems(); k++) while (index.hasNext()) { Layout.Chunk chunk = index.next();
/** * Read data subset from PositioningDataInputStream, create primitive array of size Layout.getTotalNelems. * Reading is controlled by the Layout object. * * @param is read from here. * @param index handles skipping around in the file. * @param dataType dataType of the variable * @param fillValue must Byte, Short, Integer, Long, Float, Double, or String, matching dataType, or null for none * @return primitive array with data read in * @throws java.io.IOException on read error */ static public Object readDataFill(PositioningDataInputStream is, Layout index, DataType dataType, Object fillValue) throws java.io.IOException { Object arr = (fillValue == null) ? makePrimitiveArray((int) index.getTotalNelems(), dataType) : makePrimitiveArray((int) index.getTotalNelems(), dataType, fillValue); return readData(is, index, dataType, arr); }
Object[] data = new Object[(int) layout.getTotalNelems()]; int count = 0; while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { long address = chunk.getSrcPos() + layout.getElemSize() * i; Array vlenArray = headerParser.getHeapDataArray(address, readType, endian); data[count++] = (typeInfo.base.hdfType == 7) ? convertReference(vlenArray) : vlenArray; int recsize = layout.getElemSize(); long size = recsize * layout.getTotalNelems(); byte[] byteArray = new byte[(int)size]; while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); if (chunk == null) continue; if (debugStructure) System.out.println(" readStructure " + v.getFullName() + " chunk= " + chunk + " index.getElemSize= " + layout.getElemSize());
while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos()); while (layout.hasNext()) { Layout.Chunk chunk = layout.next(); raf.order(byteOrder); raf.seek(chunk.getSrcPos());