writeNumber()

in src/internal/MessageBuffer.ts [117:160]


    writeNumber(value, type, signed = true) {
        const size = BinaryUtils.getSize(type);
        this._ensureCapacity(size);
        try {
            switch (type) {
                case BinaryUtils.TYPE_CODE.BYTE:
                    if (signed) {
                        this._buffer.writeInt8(value, this._position);
                    }
                    else {
                        this._buffer.writeUInt8(value, this._position);
                    }
                    break;
                case BinaryUtils.TYPE_CODE.SHORT:
                    if (signed) {
                        this._buffer.writeInt16LE(value, this._position);
                    }
                    else {
                        this._buffer.writeUInt16LE(value, this._position);
                    }
                    break;
                case BinaryUtils.TYPE_CODE.INTEGER:
                    if (signed) {
                        this._buffer.writeInt32LE(value, this._position);
                    }
                    else {
                        this._buffer.writeUInt32LE(value, this._position);
                    }
                    break;
                case BinaryUtils.TYPE_CODE.FLOAT:
                    this._buffer.writeFloatLE(value, this._position);
                    break;
                case BinaryUtils.TYPE_CODE.DOUBLE:
                    this._buffer.writeDoubleLE(value, this._position);
                    break;
                default:
                    throw IgniteClientError.internalError();
            }
        }
        catch (err) {
            throw IgniteClientError.valueCastError(value, type);
        }
        this._position += size;
    }