private void add(String s, boolean insert) throws IOException { if (s == null) { return; } if (lineSeparator.length > 1 || lineSeparator[0] != '\n') { s = StringUtils.replaceAll(s, "\n", lineSeparatorString); } s += ";"; if (out != null) { byte[] buff = s.getBytes(charset); int len = MathUtils.roundUpInt(buff.length + lineSeparator.length, Constants.FILE_BLOCK_SIZE); buffer = Utils.copy(buff, buffer); if (len > buffer.length) { buffer = new byte[len]; } System.arraycopy(buff, 0, buffer, 0, buff.length); for (int i = buff.length; i < len - lineSeparator.length; i++) { buffer[i] = ' '; } for (int j = 0, i = len - lineSeparator.length; i < len; i++, j++) { buffer[i] = lineSeparator[j]; } out.write(buffer, 0, len); if (!insert) { Value[] row = {ValueString.get(s)}; result.addRow(row); } } else { Value[] row = {ValueString.get(s)}; result.addRow(row); } }
public void setKey(byte[] key) { this.key = (int) Utils.readLong(key, 0); }