<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shang Liang &#187; adobe air</title>
	<atom:link href="http://shang-liang.com/blog/tag/adobe-air/feed/" rel="self" type="application/rss+xml" />
	<link>http://shang-liang.com/blog</link>
	<description>Life in a Flash</description>
	<lastBuildDate>Wed, 11 Jan 2012 11:48:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My Mistake With readBytes in AIR</title>
		<link>http://shang-liang.com/blog/readbytes-in-air/</link>
		<comments>http://shang-liang.com/blog/readbytes-in-air/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 08:37:41 +0000</pubDate>
		<dc:creator>Shang</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[filestream]]></category>
		<category><![CDATA[mistake]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=80</guid>
		<description><![CDATA[I was trying to read a specific part of a file in AIR. I thought readBytes function in FileStream can serve the purpose but I was wrong. public function readBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void Reads the number of data bytes, specified by the length parameter, from the file stream, byte stream, or byte [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to read a specific part of a file in AIR. I thought readBytes function in FileStream can serve the purpose but I was wrong.</p>
<blockquote><p>public function readBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void</p>
<p>Reads the number of data bytes, specified by the <em>length</em> parameter, from the file stream, byte stream, or byte array. <span style="text-decoration: underline;">The <em>bytes</em> are read into the ByteArray objected specified by the <em>bytes</em> parameter, starting at the position specified by <em>offset</em></span>.</p></blockquote>
<p>The <em>offset</em> parameter is defined as the offset position in <em>bytes</em>. It defines where to store the data in <em>bytes</em> not where FileStream starts to read. The correct way is to move the FileStream.position and specify the length fo data needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/readbytes-in-air/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

