Packagecom.aispeech.net.http
Classpublic class AIHttpBuffer
InheritanceAIHttpBuffer Inheritance Object



Public Properties
 PropertyDefined By
  bytesAvailable : uint
[read-only] Get number of bytes available for reading.
AIHttpBuffer
  content : ByteArray
[read-only]
AIHttpBuffer
  httpResponse : AIHttpResponse
[read-only]
AIHttpBuffer
  RESPONSE_CONTENT_DONE : String = response.content.done
[static]
AIHttpBuffer
  RESPONSE_CR : String = response.CR
[static]
AIHttpBuffer
  RESPONSE_HDR_ALMOST_DONE : String = response.HDR.almose.done
[static]
AIHttpBuffer
  RESPONSE_HDR_DONE : String = response.HDR.done
[static]
AIHttpBuffer
  RESPONSE_KEY : String = response.key
[static]
AIHttpBuffer
  RESPONSE_KEY_SPACE : String = response.key.space
[static]
AIHttpBuffer
  RESPONSE_LF : String = response.LF
[static]
AIHttpBuffer
  RESPONSE_START : String = response.start
[static]
AIHttpBuffer
  RESPONSE_STATUS_CODE : String = response.status.code
[static]
AIHttpBuffer
  RESPONSE_STATUS_INFO : String = response.status.info
[static]
AIHttpBuffer
  RESPONSE_VALUE : String = response.value
[static]
AIHttpBuffer
  RESPONSE_VERSION : String = response.version
[static]
AIHttpBuffer
  RESPONSE_WAIT_STATUS : String = response.wait.status
[static]
AIHttpBuffer
  RESPONSE_WAIT_STATUS_INFO : String = response.wait.status.info
[static]
AIHttpBuffer
  state : String
[read-only]
AIHttpBuffer
Protected Properties
 PropertyDefined By
  _chunkLength : uint = 0
AIHttpBuffer
  _content : ByteArray
AIHttpBuffer
  _cursor : uint = 0
AIHttpBuffer
  _data : ByteArray
AIHttpBuffer
Public Methods
 MethodDefined By
  
AIHttpBuffer
  
parse():void
parse HTTP response
AIHttpBuffer
  
read(bytes:ByteArray):void
Read all data from the current position into the specified byte array.
AIHttpBuffer
  
readAvailable():ByteArray
Read all available bytes.
AIHttpBuffer
  
readChunks(onData:Function):Boolean
Read chunked encoding.
AIHttpBuffer
  
readLine(trim:Boolean = false):String
Read a line from the buffer.
AIHttpBuffer
  
truncate():void
Take bytes from current position to the end, and put them into new byte array.
AIHttpBuffer
  
writeBytes(bytes:ByteArray):void
Write bytes to this buffer.
AIHttpBuffer
Property Detail
_chunkLengthproperty
protected var _chunkLength:uint = 0

_contentproperty 
protected var _content:ByteArray

_cursorproperty 
protected var _cursor:uint = 0

_dataproperty 
protected var _data:ByteArray

bytesAvailableproperty 
bytesAvailable:uint  [read-only]

Get number of bytes available for reading.


Implementation
    public function get bytesAvailable():uint
contentproperty 
content:ByteArray  [read-only]


Implementation
    public function get content():ByteArray
httpResponseproperty 
httpResponse:AIHttpResponse  [read-only]


Implementation
    public function get httpResponse():AIHttpResponse
RESPONSE_CONTENT_DONEproperty 
public static var RESPONSE_CONTENT_DONE:String = response.content.done

RESPONSE_CRproperty 
public static var RESPONSE_CR:String = response.CR

RESPONSE_HDR_ALMOST_DONEproperty 
public static var RESPONSE_HDR_ALMOST_DONE:String = response.HDR.almose.done

RESPONSE_HDR_DONEproperty 
public static var RESPONSE_HDR_DONE:String = response.HDR.done

RESPONSE_KEYproperty 
public static var RESPONSE_KEY:String = response.key

RESPONSE_KEY_SPACEproperty 
public static var RESPONSE_KEY_SPACE:String = response.key.space

RESPONSE_LFproperty 
public static var RESPONSE_LF:String = response.LF

RESPONSE_STARTproperty 
public static var RESPONSE_START:String = response.start

RESPONSE_STATUS_CODEproperty 
public static var RESPONSE_STATUS_CODE:String = response.status.code

RESPONSE_STATUS_INFOproperty 
public static var RESPONSE_STATUS_INFO:String = response.status.info

RESPONSE_VALUEproperty 
public static var RESPONSE_VALUE:String = response.value

RESPONSE_VERSIONproperty 
public static var RESPONSE_VERSION:String = response.version

RESPONSE_WAIT_STATUSproperty 
public static var RESPONSE_WAIT_STATUS:String = response.wait.status

RESPONSE_WAIT_STATUS_INFOproperty 
public static var RESPONSE_WAIT_STATUS_INFO:String = response.wait.status.info

stateproperty 
state:String  [read-only]


Implementation
    public function get state():String
Constructor Detail
AIHttpBuffer()Constructor
public function AIHttpBuffer()



Method Detail
parse()method
public function parse():void

parse HTTP response

read()method 
public function read(bytes:ByteArray):void

Read all data from the current position into the specified byte array.

Parameters

bytes:ByteArray

readAvailable()method 
public function readAvailable():ByteArray

Read all available bytes.

Returns
ByteArray
readChunks()method 
public function readChunks(onData:Function):Boolean

Read chunked encoding.

Parameters

onData:Function — For each chunk, call function(bytes:ByteArray)

Returns
Boolean — True if done, and no more chunks, false if there is more data to expect. TODO: Footers...
readLine()method 
public function readLine(trim:Boolean = false):String

Read a line from the buffer.

Parameters

trim:Boolean (default = false)

Returns
String — Next line, or null if there was no newline character found.
truncate()method 
public function truncate():void

Take bytes from current position to the end, and put them into new byte array.

writeBytes()method 
public function writeBytes(bytes:ByteArray):void

Write bytes to this buffer. Appends data, does not rely on current position.

Parameters

bytes:ByteArray