Write typed value to memory

 @param [Node] value Value to write to memory.

 @return [Node] Returns +value+.
762299
def save( value )
      write value.values.pack( value.typecode.directive )
      value
    end
419416
private void writeIonValue(IonValue value)
        throws IonException
    {
        final int valueOffset = myBuffer.length - myOffset;

        switch (value.getType())
        {
            // scalars
            case BLOB:      writeIonBlobContent((IonBlob) value);            break;
            case BOOL:      writeIonBoolContent((IonBool) value);            break;
            case CLOB:      writeIonClobContent((IonClob) value);            break;
            case DECIMAL:   writeIonDecimalContent((IonDecimal) value);      break;
            case FLOAT:     writeIonFloatContent((IonFloat) value);          break;
            case INT:       writeIonIntContent((IonInt) value);              break;
            case NULL:      writeIonNullContent();                           break;
            case STRING:    writeIonStringContent((IonString) value);        break;
            case SYMBOL:    writeIonSymbolContent((IonSymbol) value);        break;
            case TIMESTAMP: writeIonTimestampContent((IonTimestamp) value);  break;
            // containers
            case LIST:      writeIonListContent((IonList) value);            break;
            case SEXP:      writeIonSexpContent((IonSexp) value);            break;
            case STRUCT:    writeIonStructContent((IonStruct) value);        break;
            // IonDatagram
            case DATAGRAM:  writeIonDatagramContent((IonDatagram) value);    break;
            default:
                throw new IonException("IonType is unknown: " + value.getType());
        }

        writeAnnotations(value, valueOffset);
    }
1145293
def write_attribute(name, value)
      name = name.to_sym

      if association = @associations[name]
        association.reset
      end

      @attributes_before_type_cast[name] = value

      value_casted = TypeCasting.cast_field(value, self.class.attributes[name])
      attributes[name] = value_casted
    end
180314
private Object writeSimple(Class<?> declaredType, Object value) {
        Class<?> realType = value.getClass();
        if (realType == Integer.class || realType == Long.class || realType == Short.class ||
                realType == Byte.class || realType == Float.class || realType == Double.class ||
                realType == Boolean.class) {
            return value;
        } else {
            // write as a string
            try {
                String converted = settings.getConverter().convertToString(realType, value);
                if (converted == null) {
                    throw new IllegalArgumentException("Unable to write because converter returned a null string: " + value);
                }
                return converted;
            } catch (RuntimeException ex) {
                throw new IllegalArgumentException(
                        "Unable to convert type " + declaredType.getName() + " for real type: " + realType.getName(), ex);
            }
        }
    }
1090037
function (value) {
        if (this.head === null) {
            return null;
        }

        var last = this.head._prev,
            node = last;

        if (node !== null) {
            if (value !== null) {
                do {
                    if (runtimeEquals(node._value, value)) {
                        return node;
                    }

                    node = node._prev;
                }
                while (node !== last);
            }
            else {
                do {
                    if (node._value === null) {
                        return node;
                    }

                    node = node._prev;
                }
                while (node !== last);
            }
        }

        return null;
    }
18750
def write(string)
      length = string.length
      while 0 < length
        IO::select(nil, [@sock])
        @dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log")
        length -= @sock.syswrite(string[-length..-1])
      end
    end
1107340
def node_text( value, block = nil )
      @seq_map = false
      valx = value.dup
      unless block
        block =
          if options(:UseBlock)
            '|'
          elsif not options(:UseFold) and valx =~ /\n[ \t]/ and not valx =~ /#{YAML::ESCAPE_CHAR}/
            '|'
          else
            '>'
          end
        indt = $&.to_i if block =~ /\d+/
        if valx =~ /(\A\n*[ \t#]|^---\s+)/
          indt = options(:Indent) unless indt.to_i > 0
          block += indt.to_s
        end

        block +=
          if valx =~ /\n\Z\n/
            "+"
          elsif valx =~ /\Z\n/
            ""
          else
            "-"
          end
      end
      block += "\n"
      if block[0] == ?"
        esc_skip = ( "\t\n" unless valx =~ /^[ \t]/ ) || ""
        valx = fold( YAML::escape( valx, esc_skip ) + "\"" ).chomp
        self << '"' + indent_text( valx, indt, false )
      else
        if block[0] == ?>
          valx = fold( valx )
        end
        #p [block, indt]
        self << block + indent_text( valx, indt )
      end
    end
962275
def push_variable_value(node)
      return if value_stack.empty? || @ignored_nodes.include?(node)

      definition = definition_for_node(node)

      if definition
        value = definition.value ? definition.value : definition

        push_value(value)
      end
    end
710173
def write(self, value):
        """"""
        assert self.num_write_waits > 0, self
        self.num_write_waits -= 1
        self.values.append(value)
        if self.readable:
            LOG.debug('%s is now readable', self.name)
1326570
def write(key_hash, value)
      return value if value.nil? || value.empty?
      File.open(key_path(key_hash), 'wb') do |f|
        Marshal.dump(value, f)
      end

      value
    end
70515
def cast(value)
      if value.is_a?(MySQLBinUUID::Type::Data)
        # It could be a Data object, in which case we should add dashes to the
        # string value from there.
        add_dashes(value.to_s)
      elsif value.is_a?(String) && value.encoding == Encoding::ASCII_8BIT && strip_dashes(value).length != 32
        # We cannot unpack something that looks like a UUID, with or without
        # dashes. Not entirely sure why ActiveRecord does a weird combination of
        # cast and serialize before anything needs to be saved..
        undashed_uuid = value.unpack1('H*')
        add_dashes(undashed_uuid.to_s)
      else
        super
      end
    end
1344932
def serialize(value)
      return if value.nil?
      undashed_uuid = strip_dashes(value)

      # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord
      # does not explicity escape the Binary data type. escaping is implicit as
      # the Binary data type always converts its value to a hex string.
      unless valid_undashed_uuid?(undashed_uuid)
        raise MySQLBinUUID::InvalidUUID, "#{value} is not a valid UUID"
      end

      Data.new(undashed_uuid)
    end
570444
def value=(value)
      case tag_name
      when "textarea"
        @_node.setText("")
        type(value)
      when "input"
        if file_input?
          @_node.setValueAttribute(value)
        else
          @_node.setValueAttribute("")
          type(value)
        end
      end
    end
1068685
@JRubyMethod(name = "value=")
    public static IRubyObject value_set(IRubyObject self, IRubyObject val) {
        org.yecht.Node node = (org.yecht.Node)self.dataGetStructChecked();
        Ruby runtime = self.getRuntime();
        ThreadContext ctx = runtime.getCurrentContext();

        if(!val.isNil()) {
            IRubyObject hsh = TypeConverter.convertToTypeWithCheck(val, runtime.getHash(), "to_hash");

            if(hsh.isNil()) {
                throw runtime.newTypeError("wrong argument type");
            }
            node.mapEmpty();
            IRubyObject keys = hsh.callMethod(ctx, "keys");
            for(int i = 0; i < ((RubyArray)keys).getLength(); i++) {
                IRubyObject key = ((RubyArray)keys).entry(i);
                node.mapAdd(key, ((RubyHash)hsh).op_aref(ctx, key));
            }
        }

        ((RubyObject)self).fastSetInstanceVariable("@value", val);
        return val;
    }
1005354
function writeValue(rh, value, to) {
            if (typeof to === "undefined") { to = ''; }
            shared.utils.dassert(shared.utils.isObject(rh));
            var type = shared.utils.treatAs(value);
            switch(type) {
                case 'null':
                    to += 'null';
                    break;
                case 'undefined':
                    to += 'undefined';
                    break;
                case 'number':
                case 'Number':
                case 'boolean':
                case 'Boolean':
                    to += value.toString();
                    break;
                case 'string':
                case 'String':
                    to += JSON.stringify(value);
                    break;
                case 'Date':
                    to += JSON.stringify(value.toString());
                    break;
                case 'Object':
                case 'Array':
                    to += '<' + rh.valueId(value) + '>';
                    break;
                case 'function':
                case 'RegExp':
                case 'Error':
                    to += 'null';
                    break;
                default:
                    shared.utils.defaultLogger().fatal('Unexpected type: %s', type);
                    break;
            }
            return to;
        }
320045
def output_value_to_column_value(v)
      if v.kind_of?(Array)
        if v.length == 0
          nil
        elsif v.length == 1
          v.first
        elsif v.first.kind_of?(String)
          v.join(@internal_delimiter)
        else
          # Not a string? Um, raise for now?
          raise ArgumentError.new("Traject::SequelWriter, multiple non-String values provided: #{v}")
        end
      else
        v
      end
    end
934516
def encode(value, type)
      value = [value] unless value.is_a?(Array)
      return value.pack(vr_to_str(type))
    end