<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Serialization Error/Bug When Using a ByteArray and readObject in an IExternalizable Class?</title>
	<atom:link href="http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Fri, 12 Mar 2010 02:06:34 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Niks</title>
		<link>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/comment-page-1/#comment-363</link>
		<dc:creator>Niks</dc:creator>
		<pubDate>Mon, 06 Oct 2008 13:00:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=200#comment-363</guid>
		<description>hii, i like the article you wrote. i also wrote an article on Serialization here : http://kaniks.blogspot.com
feel free to post your comments

thanks
cheers</description>
		<content:encoded><![CDATA[<p>hii, i like the article you wrote. i also wrote an article on Serialization here : <a href="http://kaniks.blogspot.com" rel="nofollow">http://kaniks.blogspot.com</a><br />
feel free to post your comments</p>
<p>thanks<br />
cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Jastrab</title>
		<link>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/comment-page-1/#comment-289</link>
		<dc:creator>Greg Jastrab</dc:creator>
		<pubDate>Mon, 08 Sep 2008 14:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=200#comment-289</guid>
		<description>Thanks for confirming this Peter.

I guess this makes sense that the ByteArray shouldn&#039;t know about the reference table anyway, since it would be possible to read bytes into the ByteArray from multiple sources (different FileStreams) which would have separate reference tables.</description>
		<content:encoded><![CDATA[<p>Thanks for confirming this Peter.</p>
<p>I guess this makes sense that the ByteArray shouldn&#8217;t know about the reference table anyway, since it would be possible to read bytes into the ByteArray from multiple sources (different FileStreams) which would have separate reference tables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Farland</title>
		<link>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/comment-page-1/#comment-288</link>
		<dc:creator>Peter Farland</dc:creator>
		<pubDate>Mon, 08 Sep 2008 03:42:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=200#comment-288</guid>
		<description>Correct. I believe that ByteArray always expects AMF references to start at 0 and this is a problem for AMF data captured out of another stream (such as from an IExternalizable readObject() during deserialization of a NetConnection response).

You could process the raw ByteArray yourself using lower level read operations, but you would need to know what state the reference table was in (and unfortunately this is not obtainable from a NetConnection response). So instead that leaves you with completely custom serialization in the readObject()/writeObject() - such as buffering the IExternalizable content in a separate ByteArray first so that you know the references start at 0.</description>
		<content:encoded><![CDATA[<p>Correct. I believe that ByteArray always expects AMF references to start at 0 and this is a problem for AMF data captured out of another stream (such as from an IExternalizable readObject() during deserialization of a NetConnection response).</p>
<p>You could process the raw ByteArray yourself using lower level read operations, but you would need to know what state the reference table was in (and unfortunately this is not obtainable from a NetConnection response). So instead that leaves you with completely custom serialization in the readObject()/writeObject() &#8211; such as buffering the IExternalizable content in a separate ByteArray first so that you know the references start at 0.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Jastrab</title>
		<link>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/comment-page-1/#comment-286</link>
		<dc:creator>Greg Jastrab</dc:creator>
		<pubDate>Sun, 07 Sep 2008 02:40:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=200#comment-286</guid>
		<description>I just added a comment to the JIRA page of my bug, postulating what is happening with that code.  The only thing I can think of for now, after digging through the AMF spec for a bit and playing with some manual parsing is that the byte array is not utilizing the reference tables that the buffer reading the externalizable class is maintaining.

So I’ve been digging into the AMF spec for a bit, and have a guess at what’s going on here.  I believe the reference tables used in AMF3 are not being utilized by the ByteArray after it has read all of the data.

It seems that if the reference tables are not available to/used by the ByteArray this would explain why

function readExternal(input:IDataInput):void {
  ...
  var arr:Array = input.readObject() as Array;
}

would work but

function readExternal(input:IDataInput):void {
  var ba:ByteArray = new ByteArray();
  input.readBytes(ba);
  ...
  var arr:Array = ba.readObject() as Array;
}

would not work.</description>
		<content:encoded><![CDATA[<p>I just added a comment to the JIRA page of my bug, postulating what is happening with that code.  The only thing I can think of for now, after digging through the AMF spec for a bit and playing with some manual parsing is that the byte array is not utilizing the reference tables that the buffer reading the externalizable class is maintaining.</p>
<p>So I’ve been digging into the AMF spec for a bit, and have a guess at what’s going on here.  I believe the reference tables used in AMF3 are not being utilized by the ByteArray after it has read all of the data.</p>
<p>It seems that if the reference tables are not available to/used by the ByteArray this would explain why</p>
<p>function readExternal(input:IDataInput):void {<br />
  &#8230;<br />
  var arr:Array = input.readObject() as Array;<br />
}</p>
<p>would work but</p>
<p>function readExternal(input:IDataInput):void {<br />
  var ba:ByteArray = new ByteArray();<br />
  input.readBytes(ba);<br />
  &#8230;<br />
  var arr:Array = ba.readObject() as Array;<br />
}</p>
<p>would not work.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
