コード例 #1
0
ファイル: Buffer.java プロジェクト: aw1621107/hacks
  // Write a String using the specified character encoding
  final void writeLenString(
      String s,
      String encoding,
      String serverEncoding,
      SingleByteCharsetConverter converter,
      boolean parserKnowsUnicode,
      MySQLConnection conn)
      throws UnsupportedEncodingException, SQLException {
    byte[] b = null;

    if (converter != null) {
      b = converter.toBytes(s);
    } else {
      b =
          StringUtils.getBytes(
              s,
              encoding,
              serverEncoding,
              parserKnowsUnicode,
              conn,
              conn.getExceptionInterceptor());
    }

    int len = b.length;
    ensureCapacity(len + 9);
    writeFieldLength(len);
    System.arraycopy(b, 0, this.byteBuffer, this.position, len);
    this.position += len;
  }
コード例 #2
0
ファイル: Buffer.java プロジェクト: aw1621107/hacks
  // Write a String using the specified character encoding
  final void writeStringNoNull(
      String s,
      String encoding,
      String serverEncoding,
      boolean parserKnowsUnicode,
      MySQLConnection conn)
      throws UnsupportedEncodingException, SQLException {
    byte[] b =
        StringUtils.getBytes(
            s, encoding, serverEncoding, parserKnowsUnicode, conn, conn.getExceptionInterceptor());

    int len = b.length;
    ensureCapacity(len);
    System.arraycopy(b, 0, this.byteBuffer, this.position, len);
    this.position += len;
  }