Writes a row in Hive containing exactly 5 elements (String) to a SpreadSheetCellDAO. Order: "formattedValue","comment","formula","address","sheetName"
332788
@Override
	public Writable serialize(Object arg0, ObjectInspector arg1) throws SerDeException {
		if (!(arg1 instanceof StructObjectInspector)) {
			throw new SerDeException("Expect a row of Strings for serialization");
		}
		final StructObjectInspector outputOI = (StructObjectInspector) arg1;
		final List<? extends StructField> outputFields = outputOI.getAllStructFieldRefs();
		if (outputFields.size()!=ExcelSpreadSheetCellDAOSerde.columnNames.length) {
			throw new SerDeException("Expected "+ExcelSpreadSheetCellDAOSerde.columnNames.length+" fields characterizing a cell: \"formattedValue\",\"comment\",\"formula\",\"address\",\"sheetName\", but found "+outputFields.size()+" fields");
		}
		if (arg0==null) {
			return null;
		}
		// get field data
		// formattedValue
		int columnNum=0;
		final Object foFormattedValue = outputOI.getStructFieldData(arg0, outputFields.get(columnNum));
		final ObjectInspector oiFormattedValue = outputFields.get(columnNum).getFieldObjectInspector();
		String formattedValue = String.valueOf(((PrimitiveObjectInspector) oiFormattedValue).getPrimitiveJavaObject(foFormattedValue));
		// comment
		columnNum=1;
		final Object foComment= outputOI.getStructFieldData(arg0, outputFields.get(columnNum));
		final ObjectInspector oiComment = outputFields.get(columnNum).getFieldObjectInspector();
		String comment = String.valueOf(((PrimitiveObjectInspector) oiComment).getPrimitiveJavaObject(foComment));
		// formula
		columnNum=2;
		final Object foFormula= outputOI.getStructFieldData(arg0, outputFields.get(columnNum));
		final ObjectInspector oiFormula = outputFields.get(columnNum).getFieldObjectInspector();
		String formula = String.valueOf(((PrimitiveObjectInspector) oiFormula).getPrimitiveJavaObject(foFormula));
		// address
		columnNum=3;
		final Object foAddress= outputOI.getStructFieldData(arg0, outputFields.get(columnNum));
		final ObjectInspector oiAddress = outputFields.get(columnNum).getFieldObjectInspector();
		String address = String.valueOf(((PrimitiveObjectInspector) oiAddress).getPrimitiveJavaObject(foAddress));
		// sheetName
		columnNum=4;
		final Object foSheetName= outputOI.getStructFieldData(arg0, outputFields.get(columnNum));
		final ObjectInspector oiSheetName = outputFields.get(columnNum).getFieldObjectInspector();
		String sheetName = String.valueOf(((PrimitiveObjectInspector) oiSheetName).getPrimitiveJavaObject(foSheetName));
		return new SpreadSheetCellDAO(formattedValue,comment,formula,address,sheetName);
	}
664629
public void write(Iterable<?> row) throws IOException {
      if (row != null) {
         writer.write(formatter.format(row));
      }
      writer.write(SystemInfo.LINE_SEPARATOR);
   }
776332
def writeRow(self, row, values):
        '''
        
        '''
        if self.__sheet is None:
            self.openSheet(super(ExcelWrite, self).DEFAULT_SHEET)

        for index, value in enumerate(values):
            self.__sheet.write(row, index, value)
653298
function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
  tableData.forEach((rowData, rowIndex) => {
    const startIndex = rowData.length;
    if (startIndex) {
      const [{nodeName}] = rowData;

      util.range(startIndex, limitIndex).forEach(colIndex => {
        rowData.push(createBasicCell(rowIndex, colIndex, nodeName));
      });
    }
  });
}
1351058
function write(rows, geometry_type, geometries, callback) {

    var TYPE = types.geometries[geometry_type],
        writer = writers[TYPE],
        parts = writer.parts(geometries, TYPE),
        shpLength = 100 + (parts - geometries.length) * 4 + writer.shpLength(geometries),
        shxLength = 100 + writer.shxLength(geometries),
        shpBuffer = new ArrayBuffer(shpLength),
        shpView = new DataView(shpBuffer),
        shxBuffer = new ArrayBuffer(shxLength),
        shxView = new DataView(shxBuffer),
        extent = writer.extent(geometries);

    writeHeader(shpView, TYPE);
    writeHeader(shxView, TYPE);
    writeExtent(extent, shpView);
    writeExtent(extent, shxView);

    writer.write(geometries, extent,
        new DataView(shpBuffer, 100),
        new DataView(shxBuffer, 100),
        TYPE);

    shpView.setInt32(24, shpLength / 2);
    shxView.setInt32(24, (50 + geometries.length * 4));

    var dbfBuf = dbf.structure(rows);

    callback(null, {
        shp: shpView,
        shx: shxView,
        dbf: dbfBuf,
        prj: prj
    });
}
630280
@Override
    public void writeColumns(Table htable, Object rowKey, Map<String, Object> columns, String columnFamilyName)
            throws IOException
    {
        if (columns != null && !columns.isEmpty())
        {
            Put p = new Put(HBaseUtils.getBytes(rowKey));
            for (String columnName : columns.keySet())
            {
                p.addColumn(columnFamilyName.getBytes(), Bytes.toBytes(columnName),
                        HBaseUtils.getBytes(columns.get(columnName)));
            }
            htable.put(p);
        }
    }
488622
public boolean writeRow(Object row[], CSVWriter writer, boolean skipinternal,
            BinaryEncoding binaryEncoding, SimpleDateFormat dateFormatter) {

        int firstfield = getFirstField(skipinternal);
        try {
            String[] fields = new String[m_tableSchema.size() - firstfield];
            for (int i = firstfield; i < m_tableSchema.size(); i++) {
                if (row[i] == null) {
                    fields[i - firstfield] = "NULL";
                } else if (m_tableSchema.get(i) == VoltType.VARBINARY && binaryEncoding != null) {
                    if (binaryEncoding == BinaryEncoding.HEX) {
                        fields[i - firstfield] = Encoder.hexEncode((byte[]) row[i]);
                    } else {
                        fields[i - firstfield] = Encoder.base64Encode((byte[]) row[i]);
                    }
                } else if (m_tableSchema.get(i) == VoltType.STRING) {
                    fields[i - firstfield] = (String) row[i];
                } else if (m_tableSchema.get(i) == VoltType.TIMESTAMP && dateFormatter != null) {
                    TimestampType timestamp = (TimestampType) row[i];
                    fields[i - firstfield] = dateFormatter.format(timestamp.asApproximateJavaDate());
                } else {
                    fields[i - firstfield] = row[i].toString();
                }
            }
            writer.writeNext(fields);
        } catch (Exception x) {
            x.printStackTrace();
            return false;
        }
        return true;
    }
992866
private static byte[] writeCsv(String[] columnHeaders, String[][] rows) throws IOException {
    try (ByteArrayOutputStream csvStream = new ByteArrayOutputStream(); OutputStreamWriter streamWriter = new OutputStreamWriter(csvStream, Charset.forName("UTF-8"))) {
      CSVWriter csvWriter = new CSVWriter(streamWriter, ',');

      csvWriter.writeNext(columnHeaders);
      
      for (String[] row : rows) {
        csvWriter.writeNext(row);
      }

      csvWriter.close();
      
      return csvStream.toByteArray();
    }
  }
319286
public function write_number($row, $col, $num, $format = null) {
        if (!isset($this->data[$row][$col])) {
            $this->data[$row][$col] = new MoodleODSCell();
        }
        if (is_array($format)) {
            $format = new MoodleODSFormat($format);
        }
        $this->data[$row][$col]->value = $num;
        $this->data[$row][$col]->type = 'float';
        $this->data[$row][$col]->format = $format;
        $this->data[$row][$col]->formula = null;
    }
1010164
@Override
    public String writeSingle(String key) throws Exception {
        MutationBatch m = keyspace.prepareMutationBatch().withConsistencyLevel(ConsistencyLevel.valueOf(config.getWriteConsistencyLevel()));

        ColumnListMutation<Integer> colsMutation = m.withRow(this.CF, key);

        for (int i = 0; i < config.getColsPerRow(); i++) {
            colsMutation.putColumn(i, dataGenerator.getRandomValue());
        }

        m.execute();

        return ResultOK;
    }
1054680
@Override
    public void writeColumns(HTableInterface htable, String columnFamily, Object rowKey,
            Map<String, Attribute> columns,

            Map<String, Object> values, Object columnFamilyObj) throws IOException
    {
        Put p = preparePut(columnFamily, rowKey, columns, values);
        htable.put(p);
    }
785745
function createFieldRequest(columnName, position) {

    if (util.isNaN(position) || position <= 0) {
        throw new TypeError('Position should be a number which is higher than one!');
    }

    var xw = createXMLWriter();

    xw = xw.startElement('gs:cell')
        .writeAttribute('row', 1)
        .writeAttribute('col', position)
        .writeAttribute('inputValue', columnName)
        .endElement();

    return xw.endElement().toString();
}
545706
private void validateDataPerWrite() throws WriteExcelException {
        //修正数据,并校验
        if (CollectionUtils.isEmpty(this.properties)) {
            if (CollectionUtils.isEmpty(this.datas)) {
                //此种情况下被写入数据不能为空,因为默认会根据datas去自动获取需要被写入的属性
                throw new WriteExcelException("datas为空,请检查数据");
            }
            T data = this.datas.get(0);
            this.setProperties(data instanceof Map ? ((Map) data).keySet() : CommonUtils.toMap(data).keySet());
        }
        if (CollectionUtils.isNotEmpty(this.excludeProps)) {
            //若设置了排除元素,先将元素排除
            this.properties.removeAll(this.excludeProps);
        }
        if (CollectionUtils.isEmpty(this.properties)) {
            throw new WriteExcelException("properties为空!");
        }
        if (this.isWriteTitle && CollectionUtils.isEmpty(this.titles)) {
            this.setTitles(this.properties);
        }
        if (this.isWriteTitle && this.properties.size() != this.titles.size()) {
            throw new WriteExcelException("属性与标题列数不一致");
        }
        if (XLSX == this.excelType && this.properties.size() > XLSX_COLUMN_MOST) {
            throw new WriteExcelException(String.format("列数不得超过最大值%d", XLSX_COLUMN_MOST));
        }
        if (XLS == this.excelType && this.properties.size() > XLS_COLUMN_MOST) {
            throw new WriteExcelException(String.format("列数不得超过最大值%d", XLS_COLUMN_MOST));
        }
        if (this.defaultCellStyle == null) {
            this.defaultCellStyle = this.workbook.createCellStyle();
            this.defaultCellStyle.setFont(this.workbook.createFont());
            this.defaultCellStyle.setAlignment(HorizontalAlignment.CENTER);
            this.defaultCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        }
        if (this.isWriteTitle && this.defaultTitleCellStyle == null) {
            this.defaultTitleCellStyle = this.workbook.createCellStyle();
            Font font = this.workbook.createFont();
            font.setBold(true);
            font.setFontHeightInPoints((short) 16);
            this.defaultTitleCellStyle.setFont(font);
            this.defaultTitleCellStyle.setAlignment(HorizontalAlignment.CENTER);
            this.defaultTitleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        }
        if (this.handleCellValue != null) {
            this.map = new HashMap<>(2);
        }
    }
609586
private void dumpRow(java.io.PrintStream out, short table[], int   state) {
        StringBuilder dest = new StringBuilder(fHeader.fCatCount*5 + 20);
        dest.append(intToString(state, 4));
        int row = getRowIndex(state);
        if (table[row+ACCEPTING] != 0) {
           dest.append(intToString(table[row+ACCEPTING], 5));
        }else {
            dest.append("     ");
        }
        if (table[row+LOOKAHEAD] != 0) {
            dest.append(intToString(table[row+LOOKAHEAD], 5));
        }else {
            dest.append("     ");
        }
        dest.append(intToString(table[row+TAGIDX], 5));

        for (int col=0; col<fHeader.fCatCount; col++) {
            dest.append(intToString(table[row+NEXTSTATES+col], 5));
        }

        out.println(dest);
    }
1289708
public void writeData(int l, Type[] types, Object[] data,
                          HashMappedList cols, int[] primaryKeys) {

        boolean hasPK = primaryKeys != null && primaryKeys.length != 0;
        int     limit = hasPK ? primaryKeys.length
                              : l;

        for (int i = 0; i < limit; i++) {
            int    j = hasPK ? primaryKeys[i]
                             : i;
            Object o = data[j];
            Type   t = types[j];

            if (cols != null) {
                ColumnSchema col = (ColumnSchema) cols.get(j);

                writeFieldPrefix();
                writeString(col.getName().statementName);
            }

            if (o == null) {
                writeNull(t);

                continue;
            }

            writeFieldType(t);

            switch (t.typeCode) {

                case Types.SQL_ALL_TYPES :
                    throw Error.runtimeError(
                        ErrorCode.U_S0500, "RowOutputBase");
                case Types.SQL_CHAR :
                case Types.SQL_VARCHAR :
                case Types.VARCHAR_IGNORECASE :
                    writeChar((String) o, t);
                    break;

                case Types.TINYINT :
                case Types.SQL_SMALLINT :
                    writeSmallint((Number) o);
                    break;

                case Types.SQL_INTEGER :
                    writeInteger((Number) o);
                    break;

                case Types.SQL_BIGINT :
                    writeBigint((Number) o);
                    break;

                case Types.SQL_REAL :
                case Types.SQL_FLOAT :
                case Types.SQL_DOUBLE :
                    writeReal((Double) o);
                    break;

                case Types.SQL_NUMERIC :
                case Types.SQL_DECIMAL :
                    writeDecimal((BigDecimal) o, t);
                    break;

                case Types.SQL_BOOLEAN :
                    writeBoolean((Boolean) o);
                    break;

                case Types.SQL_DATE :
                    writeDate((TimestampData) o, t);
                    break;

                case Types.SQL_TIME :
                case Types.SQL_TIME_WITH_TIME_ZONE :
                    writeTime((TimeData) o, t);
                    break;

                case Types.SQL_TIMESTAMP :
                case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                    writeTimestamp((TimestampData) o, t);
                    break;

                case Types.SQL_INTERVAL_YEAR :
                case Types.SQL_INTERVAL_YEAR_TO_MONTH :
                case Types.SQL_INTERVAL_MONTH :
                    writeYearMonthInterval((IntervalMonthData) o, t);
                    break;

                case Types.SQL_INTERVAL_DAY :
                case Types.SQL_INTERVAL_DAY_TO_HOUR :
                case Types.SQL_INTERVAL_DAY_TO_MINUTE :
                case Types.SQL_INTERVAL_DAY_TO_SECOND :
                case Types.SQL_INTERVAL_HOUR :
                case Types.SQL_INTERVAL_HOUR_TO_MINUTE :
                case Types.SQL_INTERVAL_HOUR_TO_SECOND :
                case Types.SQL_INTERVAL_MINUTE :
                case Types.SQL_INTERVAL_MINUTE_TO_SECOND :
                case Types.SQL_INTERVAL_SECOND :
                    writeDaySecondInterval((IntervalSecondData) o, t);
                    break;

                case Types.OTHER :
                    writeOther((JavaObjectData) o);
                    break;

                case Types.SQL_BLOB :
                    writeBlob((BlobData) o, t);
                    break;

                case Types.SQL_CLOB :
                    writeClob((ClobData) o, t);
                    break;

                case Types.SQL_BINARY :
                case Types.SQL_VARBINARY :
                    writeBinary((BinaryData) o);
                    break;

                case Types.SQL_BIT :
                case Types.SQL_BIT_VARYING :
                    writeBit((BinaryData) o);
                    break;

                default :
                    throw Error.runtimeError(
                        ErrorCode.U_S0500,
                        t.getNameString());
            }
        }
    }
51217
private boolean writePerRow(Row row, Map<String, Object> data, T originData) throws WriteExcelException {
        boolean isNotBlankRow = false;
        //标识当前写入的列
        int currenCol = -1;
        for (String property : this.properties) {
            currenCol++;
            if (data.containsKey(property)) {
                Cell cell = row.createCell(currenCol);
                if (this.handleCellValue != null) {
                    this.map.clear();
                    this.handleCellValue.callback(property, data.get(property), originData, this);
                }
                CellStyle cellStyleTemp = this.defaultCellStyle;
                Object value = data.get(property);
                if (MapUtils.isNotEmpty(this.cellStyleMapping) && this.cellStyleMapping.containsKey(property)) {
                    cellStyleTemp = this.cellStyleMapping.get(property);
                }
                if (MapUtils.isNotEmpty(this.map)) {
                    if (this.map.get(CELL_STYLE) instanceof CellStyle) {
                        cellStyleTemp = (CellStyle) this.map.get(CELL_STYLE);
                    }
                    value = this.map.getOrDefault(CELL_VALUE, value);
                }
                cell.setCellStyle(cellStyleTemp);
                if (!this.setCellValue(cell, value, property)) {
                    isNotBlankRow = true;
                }
            }
        }
        return isNotBlankRow;
    }
995401
@SuppressWarnings("unchecked")
    private void writeRows(Cell templateCell, List<Object> items) {
        val tmplRow = templateCell.getRow();
        val fromRow = tmplRow.getRowNum();

        val tmplCol = templateCell.getColumnIndex();
        for (int i = 0, ii = items.size(); i < ii; ++i) {
            val item = items.get(i);
            val row = i == 0 ? tmplRow : sheet.createRow(fromRow + i);
            if (row != tmplRow) {
                row.setHeight(tmplRow.getHeight());
            }

            val fields = item.getClass().getDeclaredFields();
            int cutoff = 0;
            for (int j = 0; j < fields.length; ++j) {
                val field = fields[j];
                if (Fields.shouldIgnored(field, ExcelColIgnore.class)) {
                    ++cutoff;
                    continue;
                }
                if (field.getName().endsWith("Tmpl")) {
                    ++cutoff;
                    continue;
                }

                val fv = Fields.invokeField(field, item);
                val excelCell = field.getAnnotation(ExcelCell.class);
                int maxLen = excelCell == null ? 0 : excelCell.maxLineLen();
                val cell = newCell(tmplRow, tmplCol + j - cutoff, i, row, fv, maxLen);
                applyTemplateCellStyle(field, item, excelCell, cell);
            }

            emptyEndsCells(tmplRow, tmplCol, i, row, fields.length);
        }
    }