Java Code Examples for io.netty.buffer.ByteBuf#writeDoubleLE()

The following examples show how to use io.netty.buffer.ByteBuf#writeDoubleLE() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtendedQueryCommandCodec.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
private void encodeFloat8Parameter(ByteBuf payload, Double value) {
  payload.writeByte(0x00);
  payload.writeByte(0x00);
  payload.writeByte(MSSQLDataTypeId.FLTNTYPE_ID);
  payload.writeByte(8);
  payload.writeByte(8);
  payload.writeDoubleLE(value);
}
 
Example 2
Source File: GeometryWkbFormatCodec.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
private static void encodeWkbLineString(ByteBuf buffer, LineString wkbLineString) {
  buffer.writeByte(WKB_BYTE_ORDER_LITTLE_ENDIAN);
  buffer.writeIntLE(WKB_GEOMETRY_TYPE_LINESTRING);
  buffer.writeIntLE(wkbLineString.getPoints().size());
  for (Point point : wkbLineString.getPoints()) {
    buffer.writeDoubleLE(point.getX());
    buffer.writeDoubleLE(point.getY());
  }
}
 
Example 3
Source File: GeometryWkbFormatCodec.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
private static void encodeWkbPolygon(ByteBuf buffer, Polygon polygon) {
  buffer.writeByte(WKB_BYTE_ORDER_LITTLE_ENDIAN);
  buffer.writeIntLE(WKB_GEOMETRY_TYPE_POLYGON);
  buffer.writeIntLE(polygon.getLineStrings().size());
  for (LineString lineString : polygon.getLineStrings()) {
    buffer.writeIntLE(lineString.getPoints().size());
    for (Point point : lineString.getPoints()) {
      buffer.writeDoubleLE(point.getX());
      buffer.writeDoubleLE(point.getY());
    }
  }
}
 
Example 4
Source File: MySQLJsonValueDecoderTest.java    From shardingsphere with Apache License 2.0 5 votes vote down vote up
private void writeValueToByteBuf(final JsonEntry jsonEntry, final ByteBuf byteBuf, final boolean isSmall) {
    switch (jsonEntry.getType()) {
        case JsonValueTypes.SMALL_JSON_OBJECT:
            byteBuf.writeBytes(mockJsonObjectByteBufValue((List<JsonEntry>) jsonEntry.getValue(), true));
            break;
        case JsonValueTypes.LARGE_JSON_OBJECT:
            byteBuf.writeBytes(mockJsonObjectByteBufValue((List<JsonEntry>) jsonEntry.getValue(), false));
            break;
        case JsonValueTypes.SMALL_JSON_ARRAY:
            byteBuf.writeBytes(mockJsonArrayByteBufValue((List<JsonEntry>) jsonEntry.getValue(), true));
            break;
        case JsonValueTypes.LARGE_JSON_ARRAY:
            byteBuf.writeBytes(mockJsonArrayByteBufValue((List<JsonEntry>) jsonEntry.getValue(), false));
            break;
        case JsonValueTypes.INT32:
        case JsonValueTypes.UINT32:
            if (isSmall) {
                byteBuf.writeIntLE((int) jsonEntry.getValue());
            }
            break;
        case JsonValueTypes.INT64:
        case JsonValueTypes.UINT64:
            byteBuf.writeLongLE((long) jsonEntry.getValue());
            break;
        case JsonValueTypes.DOUBLE:
            byteBuf.writeDoubleLE((double) jsonEntry.getValue());
            break;
        case JsonValueTypes.STRING:
            writeString(byteBuf, (String) jsonEntry.getValue());
            break;
        default:
    }
}
 
Example 5
Source File: DataTypeCodec.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
private static void binaryEncodeDouble(Number value, ByteBuf buffer) {
  buffer.writeDoubleLE(value.doubleValue());
}
 
Example 6
Source File: GeometryWkbFormatCodec.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
private static void encodeWkbPoint(ByteBuf buffer, Point wkbPoint) {
  buffer.writeByte(WKB_BYTE_ORDER_LITTLE_ENDIAN);
  buffer.writeIntLE(WKB_GEOMETRY_TYPE_POINT);
  buffer.writeDoubleLE(wkbPoint.getX());
  buffer.writeDoubleLE(wkbPoint.getY());
}