############### Serialization ###################
508837
@Override
    public double[] read(ScanBuffer buffer) {
        int length = getLength(buffer);
        if (length<0) return null;
        return buffer.getDoubles(length);
    }
86193
function __serializeArray(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	// ignore undefined value
	for (let key in data) {
		let subData = data[key];
		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...subDataBuffers);
	}
	let length = __getLengthByArrayBuffers(dataBuffers);
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, ...dataBuffers];
}
1003495
private void _serializeArray(Array array, StringBuilder sb, Set<Object> done) throws ConverterException {
	_serializeList(array.toList(), sb, done);
    }
17235
public function serialize()
    {
        $str = $this->name;
        if ($this->group) {
            $str = $this->group.'.'.$this->name;
        }

        foreach ($this->parameters() as $param) {
            $str .= ';'.$param->serialize();
        }

        $str .= ':'.$this->getRawMimeDirValue();

        $str = \preg_replace(
            '/(
                (?:^.)?         # 1 additional byte in first line because of missing single space (see next line)
                .{1,74}         # max 75 bytes per line (1 byte is used for a single space added after every CRLF)
                (?![\x80-\xbf]) # prevent splitting multibyte characters
            )/x',
            "$1\r\n ",
            $str
        );

        // remove single space after last CRLF
        return \substr($str, 0, -1);
    }
122024
public byte[] serialize() {
        byte[] value = serializeValue();
        ByteBuffer buffer = ByteBuffer.allocate(value.length + 4);
        buffer.putShort(tag);
        buffer.putShort((short)value.length);
        buffer.put(value);
        return buffer.array();
    }
890469
public function serialize()
	{
		// Load all of the inputs.
		$this->loadAllInputs();

		// Remove $_ENV and $_SERVER from the inputs.
		$inputs = $this->inputs;
		unset($inputs['env'], $inputs['server']);

		// Serialize the options, data, and inputs.
		return serialize(array($this->options, $this->data, $inputs));
	}
266953
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
    	if (message != null)
        {
            out.writeBoolean(true);
            MessageSerializer.serializeTo(message, out);
        }
        else
            out.writeBoolean(false);
    }
1110012
function __serializeObject(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
	// ignore undefined value
	for (let key of allKeys) {
		let subData = data[key];
		if (subData === undefined) continue;

		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let keyBuffers = __serializeShortString(key);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...keyBuffers, ...subDataBuffers);
	}
	let length = __getLengthByArrayBuffers(dataBuffers);
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, ...dataBuffers];
}
83762
function jsonSerialize() {
		$array = $this->toArray();
		foreach (static::$_columns as $column_name => &$type) {
			if (!isset($array[$column_name])) {
				continue;
			}
			$value = &$array[$column_name];

			if ($type === Model::COLUMN_TYPE_BOOLEAN) {
				if (0 === $value) {
					$value = false;
				} elseif (1 === $value) {
					$value = true;
				}
			} else if (
				$type === Model::COLUMN_TYPE_TIMESTAMP
				|| $type === Model::COLUMN_TYPE_INTEGER_TIMESTAMP
			) {
				if (!$value) {
					$array[$column_name] = null;
					continue;
				}
				if (!is_int($value)) {
					$value = strtotime($value);
				}
				if (!is_int($value)) {
					throw new RuntimeException('Error parsing date "' . $array[$column_name] . '"');
				}
				$value = date('c', $value);
			}
		}
		return $array;
	}
285058
function serialize(model) {
    var data = model.toJSON();
    Object.keys(data).forEach(function serializeRecur(key) {
        var value = data[key];
        // if any value can be serialized toJSON() then do it
        if (value && value.toJSON) {
            data[key] = data[key].toJSON();
        }
    });
    return data;
}
1176512
function dictify(serializedFormArray) {
  var o = {};
  $.each(serializedFormArray, function() {
    if (o[this.name] !== undefined) {
      if (!o[this.name].push) {
        o[this.name] = [o[this.name]];
      }
      o[this.name].push(this.value || '');
    } else {
      o[this.name] = this.value || '';
    }
  });
  return o;
}
1363913
@Override
  public void serialize(ByteBuffer buffer) {
    ByteBuffer buf = buffer.order() == LITTLE_ENDIAN ? buffer : buffer.slice().order(LITTLE_ENDIAN);
    int startOffset;
    boolean hasrun = hasRunCompression();
    if (hasrun) {
      buf.putInt(SERIAL_COOKIE | ((size - 1) << 16));
      int offset = buf.position();
      for (int i = 0; i < size; i += 8) {
        int runMarker = 0;
        for (int j = 0; j < 8 && i + j < size; ++j) {
          if (values[i + j] instanceof MappeableRunContainer) {
            runMarker |= (1 << j);
          }
        }
        buf.put((byte)runMarker);
      }
      int runMarkersLength = buf.position() - offset;
      if (this.size < NO_OFFSET_THRESHOLD) {
        startOffset = 4 + 4 * this.size + runMarkersLength;
      } else {
        startOffset = 4 + 8 * this.size + runMarkersLength;
      }
    } else { // backwards compatibility
      buf.putInt(SERIAL_COOKIE_NO_RUNCONTAINER);
      buf.putInt(size);
      startOffset = 4 + 4 + 4 * this.size + 4 * this.size;
    }
    for (int k = 0; k < size; ++k) {
      buf.putShort(this.keys[k]);
      buf.putShort((short) (this.values[k].getCardinality() - 1));
    }
    if ((!hasrun) || (this.size >= NO_OFFSET_THRESHOLD)) {
      // writing the containers offsets
      for (int k = 0; k < this.size; ++k) {
        buf.putInt(startOffset);
        startOffset = startOffset + this.values[k].getArraySizeInBytes();
      }
    }
    for (int k = 0; k < size; ++k) {
      values[k].writeArray(buf);
    }
    if (buf != buffer) {
      buffer.position(buffer.position() + buf.position());
    }
  }
440858
function serialize($charset_encoding='')
		{
			// add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
			//if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
			//{
				reset($this->me);
				list($typ, $val) = each($this->me);
				return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";
			//}
		}
1296380
public function unserialize($serialized) {
		$arr = \unserialize($serialized);
		$this->_Value = $arr[0];
		$this->_Encoding = $arr[1];
	}
1028320
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
    	super.unserializeFrom(in);
    	browserId = new IntegerID(in.readInt());   
    }
1179762
@Override
    public byte[] serialize(Object theObject)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.entry(tc, "serialize = " + theObject.getClass());
        }

        byte[] idBytes = null;

        if (theObject instanceof WrapperProxy) // F58064
        {
            WrapperProxyState state = WrapperProxyState.getWrapperProxyState(theObject);
            idBytes = state.getSerializerBytes();

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "serialized a WrapperProxy for " + state);
        }
        else
        {
            EJSWrapperBase wrapper = null;
            if (theObject instanceof EJSWrapperBase)
            {
                wrapper = (EJSWrapperBase) theObject;
            }
            else if (theObject instanceof LocalBeanWrapper) // d609263
            {
                wrapper = EJSWrapperCommon.getLocalBeanWrapperBase((LocalBeanWrapper) theObject);
            }
            else
            {
                throw new IllegalArgumentException(" theObject parameter must be a EJB_LOCAL, EJB_LOCAL_HOME"
                                                   + ", EJB_BUSINESS_LOCAL, or EJB_BUSINESS_REMOTE ObjectType. Use the getObjectType"
                                                   + " to obtain the ObjectType.");
            }

            // Get the BeanId and WrapperInterface from the wrapper.
            BeanId beanId = wrapper.beanId;
            WrapperInterface wrapperInterface = wrapper.ivInterface;
            BeanMetaData bmd = wrapper.bmd;

            // Use type of wrapper interface to determine whether to
            // serialize a WrapperId or a BeanId object.
            if (wrapperInterface == WrapperInterface.BUSINESS_LOCAL)
            {
                // Serialize a WrapperId for local business interface.
                int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
                String interfaceName;
                if (interfaceIndex == EJSWrapperBase.AGGREGATE_LOCAL_INDEX) { // F743-34304
                    interfaceName = EJSWrapperBase.AGGREGATE_EYE_CATCHER; // d677413
                } else {
                    Class<?> biClass = bmd.ivBusinessLocalInterfaceClasses[interfaceIndex];
                    interfaceName = biClass.getName();
                }
                WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
                , interfaceName
                                , interfaceIndex);
                idBytes = wrapperId.getBytes();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
                                 + ", local business interface = " + interfaceName);
                }
            }
            else if (wrapperInterface == WrapperInterface.BUSINESS_REMOTE)
            {
                // Serialize a WrapperId for remote business interface.
                int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
                Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
                String interfaceName = biClass.getName();
                WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
                , interfaceName
                                , interfaceIndex);
                idBytes = wrapperId.getBytes();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
                                 + ", remote business interface = " + interfaceName);
                }
            }
            else if (wrapperInterface == WrapperInterface.BUSINESS_RMI_REMOTE)
            {
                // Serialize a WrapperId for a RMI remote business interface.
                int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
                Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
                String interfaceName = biClass.getName();
                WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
                , interfaceName
                                , interfaceIndex);
                idBytes = wrapperId.getBytes();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
                                 + ", RMI remote business interface = " + interfaceName);
                }
            }
            else
            {
                // Not a business interface, so must be a local or remote interface of
                // a 2.1 bean or a 2.1 view of a EJB 3 bean.  Either case, we only need
                // to save the BeanId for this kind of wrapper.
                idBytes = beanId.getByteArrayBytes(); //d466573
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized a BeanId = " + beanId);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.exit(tc, "serialize");
        }

        return idBytes;
    }
735772
@Override
    protected byte[] serialize(Object o) {
        ClassLoaderRegisteringObjectInputStream.register(o.getClass());
        return super.serialize(o);
    }