Example #1
0
  public Close(String name, StatementType type) {
    this.name = name;
    this.type = type;

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
      out.write(getFirstByte());
      ByteUtils.writeInt4(out, 0);
      switch (type) {
        case Portal:
          out.write('P');
          break;
        case Prepared:
          out.write('S');
          break;
      }
      ByteUtils.writeString(out, name);
    } catch (Exception e) {
      // we cannot be here
    }
    this.bytes = out.toByteArray();
    ByteUtils.fixLength(bytes);
  }