org.red5.io.amf
Class Input

java.lang.Object
  extended by org.red5.io.object.BaseInput
      extended by org.red5.io.amf.Input
All Implemented Interfaces:
Input
Direct Known Subclasses:
Input

public class Input
extends BaseInput
implements Input

Input for Red5 data types

Author:
The Red5 Project (red5@osflash.org), Luke Hubbard, Codegent Ltd (luke@codegent.com)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.red5.io.object.BaseInput
BaseInput.ReferenceMode
 
Field Summary
protected  org.apache.mina.common.ByteBuffer buf
           
protected  byte currentDataType
           
protected static org.slf4j.Logger log
           
 
Fields inherited from class org.red5.io.object.BaseInput
referenceMode, refId, refMap
 
Constructor Summary
Input(org.apache.mina.common.ByteBuffer buf)
          Creates Input object from byte buffer
 
Method Summary
protected  Class getPropertyType(Object instance, String propertyName)
           
 String getString()
          Reads string from buffer
static String getString(org.apache.mina.common.ByteBuffer buf)
          Returns a string based on the buffer
 boolean hasMoreProperties()
          Returns a boolean stating whether there are more properties
protected  Object newInstance(String className)
          Creats a new instance of the className parameter and returns as an Object
 Object readArray(Deserializer deserializer)
          Read an array.
protected  Object readBean(Deserializer deserializer, Object bean)
          Reads the input as a bean and returns an object
 Boolean readBoolean()
          Reads a boolean.
 ByteArray readByteArray()
          Read ByteArray object.
 Object readCustom()
          Reads Custom
 byte readDataType()
          Reads the data type.
protected  byte readDataType(byte dataType)
          Reads the data type.
 Date readDate()
          Returns a date
 Map<String,Object> readKeyValues(Deserializer deserializer)
          Read key - value pairs.
protected  void readKeyValues(Map<String,Object> result, Deserializer deserializer)
          Read key - value pairs into Map object
 Object readMap(Deserializer deserializer)
          Read a map containing key - value pairs.
 Object readNull()
          Reads a null.
 Number readNumber()
          Reads a Number.
 Object readObject(Deserializer deserializer)
          Reads start object
 String readPropertyName()
          Reads property name
 Object readReference()
          Reads Reference
protected  Map<String,Object> readSimpleObject(Deserializer deserializer)
          Reads the input as a map and returns a Map
 String readString()
          Reads a string
 Document readXML()
          Reads XML
 void reset()
          Resets map
 void reset(BaseInput.ReferenceMode mode)
          Resets map and set mode to handle references
 void skipEndObject()
          Skips end object
 void skipPropertySeparator()
          Skips property seperator
 
Methods inherited from class org.red5.io.object.BaseInput
clearReferences, getReference, storeReference, storeReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.red5.io.object.Input
clearReferences
 

Field Detail

log

protected static org.slf4j.Logger log

buf

protected org.apache.mina.common.ByteBuffer buf

currentDataType

protected byte currentDataType
Constructor Detail

Input

public Input(org.apache.mina.common.ByteBuffer buf)
Creates Input object from byte buffer

Parameters:
buf - Byte buffer
Method Detail

readDataType

public byte readDataType()
Reads the data type.

Specified by:
readDataType in interface Input
Returns:
byte Data type

readDataType

protected byte readDataType(byte dataType)
Reads the data type.

Parameters:
dataType - Data type as byte
Returns:
One of AMF class constants with type
See Also:
org.red5.io.amf.AMF}

readNull

public Object readNull()
Reads a null.

Specified by:
readNull in interface Input
Returns:
Object

readBoolean

public Boolean readBoolean()
Reads a boolean.

Specified by:
readBoolean in interface Input
Returns:
boolean

readNumber

public Number readNumber()
Reads a Number. In ActionScript 1 and 2 Number type represents all numbers, both floats and integers.

Specified by:
readNumber in interface Input
Returns:
Number

getString

public String getString()
Reads string from buffer

Specified by:
getString in interface Input
Returns:
String

readString

public String readString()
Reads a string

Specified by:
readString in interface Input
Returns:
String

getString

public static String getString(org.apache.mina.common.ByteBuffer buf)
Returns a string based on the buffer

Parameters:
buf - Byte buffer with data
Returns:
String Decoded string

readDate

public Date readDate()
Returns a date

Specified by:
readDate in interface Input
Returns:
Date Decoded string object

readArray

public Object readArray(Deserializer deserializer)
Description copied from interface: Input
Read an array. This can result in a List or Map being deserialized depending on the array type found.

Specified by:
readArray in interface Input
Returns:
array

readKeyValues

public Map<String,Object> readKeyValues(Deserializer deserializer)
Read key - value pairs. This is required for the RecordSet deserializer.

Specified by:
readKeyValues in interface Input

readKeyValues

protected void readKeyValues(Map<String,Object> result,
                             Deserializer deserializer)
Read key - value pairs into Map object

Parameters:
result - Map to put resulting pair to
deserializer - Deserializer used

readMap

public Object readMap(Deserializer deserializer)
Description copied from interface: Input
Read a map containing key - value pairs. This can result in a List or Map being deserialized depending on the map type found.

Specified by:
readMap in interface Input
Returns:
Map

newInstance

protected Object newInstance(String className)
Creats a new instance of the className parameter and returns as an Object

Parameters:
className - Class name as String
Returns:
Object New object instance (for given class)

readBean

protected Object readBean(Deserializer deserializer,
                          Object bean)
Reads the input as a bean and returns an object

Parameters:
deserializer - Deserializer used
bean - Input as bean
Returns:
Decoded object

readSimpleObject

protected Map<String,Object> readSimpleObject(Deserializer deserializer)
Reads the input as a map and returns a Map

Parameters:
deserializer - Deserializer to use
Returns:
Read map

readObject

public Object readObject(Deserializer deserializer)
Reads start object

Specified by:
readObject in interface Input
Parameters:
deserializer - Deserializer to use
Returns:
Read object

hasMoreProperties

public boolean hasMoreProperties()
Returns a boolean stating whether there are more properties

Returns:
boolean true if there are more properties to read, false otherwise

readPropertyName

public String readPropertyName()
Reads property name

Returns:
String Object property name

skipPropertySeparator

public void skipPropertySeparator()
Skips property seperator


skipEndObject

public void skipEndObject()
Skips end object


readXML

public Document readXML()
Reads XML

Specified by:
readXML in interface Input
Returns:
String XML as string

readCustom

public Object readCustom()
Reads Custom

Specified by:
readCustom in interface Input
Returns:
Object Custom type object

readByteArray

public ByteArray readByteArray()
Read ByteArray object. This is not supported by the AMF0 deserializer.

Specified by:
readByteArray in interface Input
Returns:
ByteArray object

readReference

public Object readReference()
Reads Reference

Specified by:
readReference in interface Input
Returns:
Object Read reference to object

reset

public void reset(BaseInput.ReferenceMode mode)
Resets map and set mode to handle references

Parameters:
mode - mode to handle references

reset

public void reset()
Resets map


getPropertyType

protected Class getPropertyType(Object instance,
                                String propertyName)


Copyright © 2006-2007 the Red5 project.