             result += digit * powerOfSixteen;
         }
         return result;
+    }
+    
+    /**
+     *  Helper method to reset parser to initial state.
+     */
+    private function resetParserState():void
+    {
+        state = INIT_STATE;
+        chunkBuffer = null;
+        hexChunkSize = null;
+        dataBytesToRead = -1;
+        dataOffset = 0;        
     }
 
     /**

     *  The server-assigned id for the streaming connection.
     */
    protected var streamId:String;

    /**
     *  Storage for the hex-format chunk size value from the byte stream.

     */
    public function openStreamingConnection(appendToURL:String=null):void
    {
        _appendToURL = appendToURL;
        
    	// Construct the streaming connection if needed.
        if (streamingConnection == null)
        {
