/** * * * @param SerializationStreamReader $streamReader * @param HashMap $instance * @throws SerializationException */ public static function deserialize(SerializationStreamReader $streamReader, $instance) { $consuming_type = 0; // HashMap if ($instance instanceof HashMap) { $consuming_type = 0; } else { if (is_array($instance)) { $consuming_type = 1; } else { require_once GWTPHP_DIR . '/maps/java/lang/SerializationException.class.php'; throw new SerializationException("Error occurred while deserialize HashMap: " . "HashMap_CustomFieldSerializer deserialize only array() or HashMap object, but given: " . gettype($instance)); } } $size = $streamReader->readInt(); for ($i = 0; $i < $size; ++$i) { /*Object*/ $key = $streamReader->readObject(); /*Object*/ $value = $streamReader->readObject(); if (0 == $consuming_type) { $instance->put($key, $value); } else { if (!FORCE_CAST_TO_PHP_PRIMITIVE_TYPES || is_object($key)) { echo $key . ' : ' . gettype($key); require_once GWTPHP_DIR . '/maps/java/lang/SerializationException.class.php'; throw new SerializationException("Error occurred while casting native php array to HashMap: " . "HashMap_CustomFieldSerializer serialize only array() where" . " keys object are mapped by one of following types:" . " java.lang.String, java.lang.Byte, java.lang.Character, java.lang.Double, " . "java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short , but given: " . gettype($key)); } $instance[$key] = $value; } } }
/** * * @param SerializationStreamReader $streamReader * @param ArrayList<Object> $instance * @throws SerializationException */ public static function deserialize(SerializationStreamReader $streamReader, $instance, $consuming_type, $name) { if ($consuming_type < 0) { require_once GWTPHP_DIR . '/maps/java/lang/SerializationException.class.php'; throw new SerializationException("Error occurred while deserialize {$name}: " . $name . "_CustomFieldSerializer deserialize only array() or " . "{$name} object, but given: " . gettype($instance)); } $size = $streamReader->readInt(); for ($i = 0; $i < $size; ++$i) { /*Object*/ $obj = $streamReader->readObject(); if (0 == $consuming_type) { $instance->add($obj); } else { $instance[$i] = $obj; } } }
public function readNext(SerializationStreamReader $reader) { return $reader->readInt(); }
/** * Enter description here... * @throws SerializationException * * @return Integer */ public static function instantiate(SerializationStreamReader $streamReader) { return FORCE_CAST_TO_PHP_PRIMITIVE_TYPES ? $streamReader->readInt() : new Integer($streamReader->readInt()); // return $streamReader->readInt(); }
public static function instantiate(SerializationStreamReader $streamReader) { return new Integer($streamReader->readInt()); }
/** * * * @param SerializationStreamReader $streamReader * @param unknown_type $instance * @throws SerializationException */ public static function deserialize(SerializationStreamReader $streamReader, $instance) { for ($itemIndex = 0; $itemIndex < count($instance); ++$itemIndex) { $instance[$itemIndex] = $streamReader->readInt(); } }
public static function transform(SerializationStreamReader $streamReader) { $size = $streamReader->readInt(); $result = array(); for ($i = 0; $i < $size; $i++) { $obj = $streamReader->readObject(); $value = $streamReader->readObject(); $result[$obj] = $value; } return $result; }