Send directly to socket the sql data.

@param pos      output stream
@param sqlBytes the query in UTF-8 bytes
@throws IOException if connection error occur
13878
public static void sendDirect(final PacketOutputStream pos, byte[] sqlBytes) throws IOException {
    pos.startPacket(0);
    pos.write(Packet.COM_QUERY);
    pos.write(sqlBytes);
    pos.flush();
  }
752602
public void writeTo(PacketOutputStream pos) throws IOException {
    pos.write(QUOTE);
    if (length == Long.MAX_VALUE) {
      pos.write(reader, true, noBackslashEscapes);
    } else {
      pos.write(reader, length, true, noBackslashEscapes);
    }
    pos.write(QUOTE);
  }
1220590
public void writeBytes(byte[] buffer, int offset, int length)
        throws IOException
    {
        if (buffer == null) {
            os.write('N');
        }
        else {
            while (length > 0x8000) {
                int sublen = 0x8000;

                os.write('b');
                os.write(sublen >> 8);
                os.write(sublen);

                os.write(buffer, offset, sublen);

                length -= sublen;
                offset += sublen;
            }

            os.write('B');
            os.write(length >> 8);
            os.write(length);
            os.write(buffer, offset, length);
        }
    }
997215
public static void send(final PacketOutputStream pos, final String database) throws IOException {
    pos.startPacket(0);
    pos.write(Packet.COM_INIT_DB);
    pos.write(database.getBytes("UTF-8"));
    pos.flush();
  }
931991
public static void writeInt(byte[] buf, int pos, int v) {
    checkBoundary(buf, pos, 4);
    buf[pos++] = (byte) (0xff & (v >> 24));
    buf[pos++] = (byte) (0xff & (v >> 16));
    buf[pos++] = (byte) (0xff & (v >> 8));
    buf[pos] = (byte) (0xff & v);
  }
950376
public static byte[] toByteArray(InputStream input) throws SQLException {
        byte[] result = null;
        ByteArrayOutputStream output = new ByteArrayOutputStream();

        try {
            copy(input, output);
            result = output.toByteArray();
        } catch (IOException ex) {
            throw new MjdbcSQLException(ex);
        }

        TypeHandlerUtils.closeQuietly(output);

        return result;
    }
741025
@Override
	public void updateBytes(final String columnLabel, final byte[] x) throws SQLException {
		wrapped.updateBytes(columnLabel, x);
	}
1334820
public void receiveEOF() throws SQLException, IOException {
    int c = pgInput.read();
    if (c < 0) {
      return;
    }
    throw new PSQLException(GT.tr("Expected an EOF from server, got: {0}", c),
        PSQLState.COMMUNICATION_ERROR);
  }
715183
public void writeBinary(final PacketOutputStream pos) throws IOException {
    if (loadedStream == null) {
      writeObjectToBytes();
    }
    pos.writeFieldLength(loadedStream.length);
    pos.write(loadedStream);
  }
918742
public static void send(final PacketOutputStream pos) {
    try {
      pos.startPacket(0);
      pos.write(Packet.COM_QUIT);
      pos.flush();
    } catch (IOException ioe) {
      //eat
    }
  }
1128900
public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count)
    {
        if (buffer == null)
            throw new NullPointerException();
        else if (bufferOffset < 0
                 || count < 0
                 || bufferOffset + count > buffer.length)
            throw new IndexOutOfBoundsException();
        else if (count == 0)
            return;

        checkPosition(memoryOffset);
        long end = memoryOffset + count;
        checkPosition(end - 1);
        while (memoryOffset < end)
        {
            unsafe.putByte(peer + memoryOffset, buffer[bufferOffset]);
            memoryOffset++;
            bufferOffset++;
        }
    }
127162
public void writeBinary(PacketOutputStream pos) throws IOException {
    String value = bigDecimal.toPlainString();
    pos.writeFieldLength(value.length());
    pos.write(value);
  }
589297
public static void post(URL url, String params) throws IOException {
        URLConnection conn = url.openConnection();
        if (conn instanceof HttpURLConnection) {
            ((HttpURLConnection) conn).setRequestMethod("POST");
            conn.setRequestProperty("Content-Type" , "application/json");
        }
        OutputStreamWriter writer = null;
        try {
            conn.setDoOutput(true);
            writer = new OutputStreamWriter(conn.getOutputStream(),
                    Charset.forName("UTF-8"));
            // write parameters
            writer.write(params);
            writer.flush();
        } finally {
            if (writer != null) {
                writer.close();
            }
        }
    }
465464
protected void writeByteArray(ObjectOutput output, byte[] data) throws IOException {
        if (null == data || 0 == data.length) {
            output.writeInt(-1);
        } else {
            output.writeInt(data.length);
            output.write(data);
        }
    }
1372447
@Override
	public void writeBytes(byte[] value, int offset, int length) throws JMSException
    {
        try
        {
            getOutput().write(value,offset,length);
        }
        catch (IOException e)
        {
            throw new FFMQException("Cannot write message body","IO_ERROR",e);
        }
    }
106927
public void writeBytes(byte value, int len) throws IOException {
    if (len > buf.length - pos) {
      //not enough space remaining
      byte[] arr = new byte[len];
      Arrays.fill(arr, value);
      write(arr, 0, len);
      return;
    }

    for (int i = pos; i < pos + len; i++) {
      buf[i] = value;
    }
    pos += len;
  }
1093688
protected final void doInsert(Connection c) throws SQLException {
		PreparedStatement stmt = null;
		try {
			stmt = c.prepareStatement("insert into foo values (?, ?)  ");
			stmt.setInt(1, rand.nextInt(99999));
			stmt.setString(2, "This is a text");
			stmt.executeUpdate();
		} finally {
			if (stmt != null) {
				stmt.close();
			}
		}
	}