public synchronized void writeRow(SparseMatrixRow row) throws IOException { if (!row.getValueConf().almostEquals(vconf)) { throw new IllegalArgumentException("Value conf for row does not match the writer's value conf"); } row.getBuffer().rewind(); byte[] bytes = new byte[row.getBuffer().remaining()]; row.getBuffer().get(bytes, 0, bytes.length); rowOffsets.put(row.getRowIndex(), bodyOffset); rowIndexes.add(row.getRowIndex()); body.write(bytes); bodyOffset += bytes.length; // pad rows to 8 byte offsets to speed things up. while (bodyOffset % 8 != 0) { bodyOffset++; body.write(ROW_PADDING); } }
public synchronized void writeRow(SparseMatrixRow row) throws IOException { if (!row.getValueConf().almostEquals(vconf)) { throw new IllegalArgumentException("Value conf for row does not match the writer's value conf"); } row.getBuffer().rewind(); byte[] bytes = new byte[row.getBuffer().remaining()]; row.getBuffer().get(bytes, 0, bytes.length); rowOffsets.put(row.getRowIndex(), bodyOffset); rowIndexes.add(row.getRowIndex()); body.write(bytes); bodyOffset += bytes.length; // pad rows to 8 byte offsets to speed things up. while (bodyOffset % 8 != 0) { bodyOffset++; body.write(ROW_PADDING); } }
public synchronized void writeRow(DenseMatrixRow row) throws IOException { if (!row.getValueConf().almostEquals(vconf)) { throw new IllegalArgumentException("Value conf for row does not match the writer's value conf"); } if (colIds == null) { colIds = row.getColIds(); } if (!Arrays.equals(colIds, row.getColIds())) { throw new IllegalArgumentException("Column id mismatch for row " + row.getRowIndex()); } row.getBuffer().rewind(); byte[] bytes = new byte[row.getBuffer().remaining()]; row.getBuffer().get(bytes, 0, bytes.length); rowOffsets.put(row.getRowIndex(), bodyOffset); rowIndexes.add(row.getRowIndex()); body.write(bytes); bodyOffset += bytes.length; // pad rows to 8 byte offsets to speed things up. while (bodyOffset % 8 != 0) { bodyOffset++; body.write(ROW_PADDING); } }
public synchronized void writeRow(DenseMatrixRow row) throws IOException { if (!row.getValueConf().almostEquals(vconf)) { throw new IllegalArgumentException("Value conf for row does not match the writer's value conf"); } if (colIds == null) { colIds = row.getColIds(); } if (!Arrays.equals(colIds, row.getColIds())) { throw new IllegalArgumentException("Column id mismatch for row " + row.getRowIndex()); } row.getBuffer().rewind(); byte[] bytes = new byte[row.getBuffer().remaining()]; row.getBuffer().get(bytes, 0, bytes.length); rowOffsets.put(row.getRowIndex(), bodyOffset); rowIndexes.add(row.getRowIndex()); body.write(bytes); bodyOffset += bytes.length; // pad rows to 8 byte offsets to speed things up. while (bodyOffset % 8 != 0) { bodyOffset++; body.write(ROW_PADDING); } }