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); }
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); }
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); }
/** * 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); }
/** * 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); }
/** * 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 be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, 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); }
/** * Read data subset from RandomAccessFile, create primitive array of size Layout.getTotalNelems. * Reading is controlled by the Layout object. * * @param raf 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 * @param byteOrder if equal to RandomAccessFile.ORDER_XXXX, set the byte order just before reading * @return primitive array with data read in * @throws java.io.IOException on read error */ static public Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder) 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, true); }
/** * Read data subset from RandomAccessFile, create primitive array of size Layout.getTotalNelems. * Reading is controlled by the Layout object. * * @param raf 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 * @param byteOrder if equal to RandomAccessFile.ORDER_XXXX, set the byte order just before reading * @return primitive array with data read in * @throws java.io.IOException on read error */ static public Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder) 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, true); }
/** * Read data subset from RandomAccessFile, create primitive array of size Layout.getTotalNelems. * Reading is controlled by the Layout object. * * @param raf read from here. * @param index handles skipping around in the file. * @param dataType dataType of the variable * @param fillValue must be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, or null for none * @param byteOrder if equal to RandomAccessFile.ORDER_XXXX, set the byte order just before reading * @return primitive array with data read in * @throws java.io.IOException on read error */ static public Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder) 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, true); }
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; }
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; }
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; }
public Array readData(ucar.nc2.Variable v2, Section section) throws IOException, InvalidRangeException { if (debugRead) { System.out.printf("debugRead %s %s%n", v2.toStringDebug(), section); if (v2.getShortName().equals("cref")) System.out.println("HEY"); } if (v2 instanceof Structure) return readRecordData((Structure) v2, section); N3header.Vinfo vinfo = (N3header.Vinfo) v2.getSPobject(); DataType dataType = v2.getDataType(); Layout layout = (!v2.isUnlimited()) ? new LayoutRegular(vinfo.begin, v2.getElementSize(), v2.getShape(), section) : new LayoutRegularSegmented(vinfo.begin, v2.getElementSize(), header.recsize, v2.getShape(), section); if (layout.getTotalNelems() == 0) { return Array.factory(dataType.getPrimitiveClassType(), section.getShape()); } Object data = readData(layout, dataType); return Array.factory(dataType.getPrimitiveClassType(), section.getShape(), data); }
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; assert (new Section(shape).computeSize() == layout.getTotalNelems());
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; assert (new Section(shape).computeSize() == layout.getTotalNelems());
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; assert (new Section(shape).computeSize() == layout.getTotalNelems());
@Override public Array readData(ucar.nc2.Variable v2, Section section) throws IOException, InvalidRangeException { /* if (debugRead) { System.out.printf("debugRead %s %s%n", v2.toStringDebug(), section); if (v2.getShortName().equals("cref")) System.out.println("HEY"); } */ if (v2 instanceof Structure) return readRecordData((Structure) v2, section); N3header.Vinfo vinfo = (N3header.Vinfo) v2.getSPobject(); DataType dataType = v2.getDataType(); Layout layout = (!v2.isUnlimited()) ? new LayoutRegular(vinfo.begin, v2.getElementSize(), v2.getShape(), section) : new LayoutRegularSegmented(vinfo.begin, v2.getElementSize(), header.recsize, v2.getShape(), section); if (layout.getTotalNelems() == 0) { return Array.factory(dataType, section.getShape()); } Object data = readData(layout, dataType); return Array.factory(dataType, section.getShape(), data); }
Object[] data = new Object[(int) layout.getTotalNelems()]; int count = 0; while (layout.hasNext()) { long size = recsize * layout.getTotalNelems(); byte[] byteArray = new byte[(int)size]; while (layout.hasNext()) {
Array[] data = new Array[(int) layout.getTotalNelems()]; int count = 0; while (layout.hasNext()) { long size = recsize * layout.getTotalNelems(); byte[] byteArray = new byte[(int)size]; while (layout.hasNext()) {
@Override public Array readData(ucar.nc2.Variable v2, Section section) throws IOException, InvalidRangeException { /* if (debugRead) { System.out.printf("debugRead %s %s%n", v2.toStringDebug(), section); if (v2.getShortName().equals("cref")) System.out.println("HEY"); } */ if (v2 instanceof Structure) return readRecordData((Structure) v2, section); N3header.Vinfo vinfo = (N3header.Vinfo) v2.getSPobject(); DataType dataType = v2.getDataType(); Layout layout = (!v2.isUnlimited()) ? new LayoutRegular(vinfo.begin, v2.getElementSize(), v2.getShape(), section) : new LayoutRegularSegmented(vinfo.begin, v2.getElementSize(), header.recsize, v2.getShape(), section); if (layout.getTotalNelems() == 0) { return Array.factory(dataType.getPrimitiveClassType(), section.getShape()); } Object data = readData(layout, dataType); return Array.factory(dataType.getPrimitiveClassType(), section.getShape(), data); }