## org.red5.io.amf
Class Input

    java.lang.Object
      org.red5.io.object.BaseInput
          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)

Field Summary
`protected IoBuffer` `buf`
`protected static Map<String,String>` `classAliases`
`protected byte` `currentDataType`
`protected static Logger` `log`

Fields inherited from class org.red5.io.object.BaseInput
`refId, refMap`

Constructor Summary
`Input(IoBuffer buf)` Creates Input object from byte buffer

Method Summary
`protected Type` `getPropertyType(Object instance, String propertyName)`
`String` `getString()` Reads string from buffer
`static String` `getString(IoBuffer buf)` Returns a string based on the buffer
`boolean` `hasMoreProperties()` Returns a boolean stating whether there are more properties
`protected Object` `newInstance(String className)` Creates a new instance of the className parameter and returns as an Object
`Object` `readArray(Deserializer deserializer, Type target)` Read an array.
`protected Object` `readBean(Deserializer deserializer, Object bean)` Reads the input as a bean and returns an object
`Boolean` `readBoolean(Type target)` Reads a boolean.
`ByteArray` `readByteArray(Type target)` Read ByteArray object.
`Object` `readCustom(Type target)` Reads Custom
`byte` `readDataType()` Reads the data type.
`protected byte` `readDataType(byte dataType)` Reads the data type.
`Date` `readDate(Type target)` 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, Type target)` Read a map containing key - value pairs.
`Object` `readNull(Type target)` Reads a null.
`Number` `readNumber(Type target)` Reads a Number.
`Object` `readObject(Deserializer deserializer, Type target)` Reads start object
`String` `readPropertyName()` Reads property name
`Object` `readReference(Type target)` Reads Reference
`protected Map<String,Object>` `readSimpleObject(Deserializer deserializer)` Reads the input as a map and returns a Map
`String` `readString(Type target)` Reads a string
`Document` `readXML(Type target)` Reads XML
`void` `reset()` Resets map
`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 Logger log

### classAliases

    protected static Map<String,String> classAliases

### buf

    protected IoBuffer buf

### currentDataType

    protected byte currentDataType

Constructor Detail

### Input

    public Input(IoBuffer 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:
    `AMF`

### readNull

    public Object readNull(Type target)

  Reads a null.

  Specified by:
    `readNull` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    Object

### readBoolean

    public Boolean readBoolean(Type target)

  Reads a boolean.

  Specified by:
    `readBoolean` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    boolean

### readNumber

    public Number readNumber(Type target)

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

  Specified by:
    `readNumber` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    Number

### getString

    public String getString()

  Reads string from buffer

  Specified by:
    `getString` in interface `Input`
  Returns:
    String

### readString

    public String readString(Type target)

  Reads a string

  Specified by:
    `readString` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    String

### getString

    public static String getString(IoBuffer buf)

  Returns a string based on the buffer

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

### readDate

    public Date readDate(Type target)

  Returns a date

  Specified by:
    `readDate` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    Date Decoded string object

### readArray

    public Object readArray(Deserializer deserializer,
                            Type target)

  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`
  Parameters:
    `deserializer` - deserializer
    `target` - target type
  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`
  Parameters:
    `deserializer` - deserializer
  Returns:
    key-value pairs

### 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,
                          Type target)

  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`
  Parameters:
    `deserializer` - deserializer
    `target` - target type
  Returns:
    Map

### newInstance

    protected Object newInstance(String className)

  Creates 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,
                             Type target)

  Reads start object

  Specified by:
    `readObject` in interface `Input`
  Parameters:
    `deserializer` - Deserializer to use
    `target` - target type
  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(Type target)

  Reads XML

  Specified by:
    `readXML` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    String XML as string

### readCustom

    public Object readCustom(Type target)

  Reads Custom

  Specified by:
    `readCustom` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    Object Custom type object

### readByteArray

    public ByteArray readByteArray(Type target)

  Read ByteArray object. This is not supported by the AMF0 deserializer.

  Specified by:
    `readByteArray` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    ByteArray object

### readReference

    public Object readReference(Type target)

  Reads Reference

  Specified by:
    `readReference` in interface `Input`
  Parameters:
    `target` - target type
  Returns:
    Object Read reference to object

### reset

    public void reset()

  Resets map

### getPropertyType

    protected Type getPropertyType(Object instance,
                                   String propertyName)

Copyright © 2006-2010 The Red5 Project