Object readUCharArray1D(int offsetInRecord) throws IOException { // XDR u_char fills 4 bytes but only uses one byte. int elementSizeInBytes = 4; byte[] elementArray = new byte[elementSizeInBytes]; byte[] array = new byte[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFully(elementArray); array[i] = elementArray[3]; this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readByteArray2D(int offsetInRecord, int numElementsInRecord) throws IOException { byte[] array = new byte[header.getNumDataRecords() * numElementsInRecord]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.read(array, i * numElementsInRecord, numElementsInRecord); this.raf.skipBytes(header.getRecordSizeInBytes() - numElementsInRecord); } return (array); }
Object readDoubleArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 8; double[] array = new double[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readDouble(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readIntArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; int[] array = new int[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readInt(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readDoubleArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 8; double[] array = new double[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readDouble(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readFloatArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; float[] array = new float[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFloat(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readFloatArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; float[] array = new float[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFloat(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readIntArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; int[] array = new int[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readInt(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readByteArray2D(int offsetInRecord, int numElementsInRecord) throws IOException { byte[] array = new byte[header.getNumDataRecords() * numElementsInRecord]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFully(array, i * numElementsInRecord, numElementsInRecord); this.raf.skipBytes(header.getRecordSizeInBytes() - numElementsInRecord); } return (array); }
Object readFloatArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; float[] array = new float[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFloat(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readIntArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; int[] array = new int[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readInt(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readDoubleArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 8; double[] array = new double[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readDouble(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readByteArray2D(int offsetInRecord, int numElementsInRecord) throws IOException { byte[] array = new byte[header.getNumDataRecords() * numElementsInRecord]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFully(array, i * numElementsInRecord, numElementsInRecord); this.raf.skipBytes(header.getRecordSizeInBytes() - numElementsInRecord); } return (array); }
Object readUCharArray1D(int offsetInRecord) throws IOException { // XDR u_char fills 4 bytes but only uses one byte. int elementSizeInBytes = 4; byte[] elementArray = new byte[elementSizeInBytes]; byte[] array = new byte[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFully(elementArray); array[i] = elementArray[3]; this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readUCharArray1D(int offsetInRecord) throws IOException { // XDR u_char fills 4 bytes but only uses one byte. int elementSizeInBytes = 4; byte[] elementArray = new byte[elementSizeInBytes]; byte[] array = new byte[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.read(elementArray); array[i] = elementArray[3]; this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }