Class 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, Luke Hubbard, Codegent Ltd (luke@codegent.com), Paul Gregoire (mondain@gmail.com)
  • Field Details

    • log

      protected org.slf4j.Logger log
    • classAliases

      protected static Map<String,String> classAliases
    • buf

      protected org.apache.mina.core.buffer.IoBuffer buf
    • currentDataType

      protected byte currentDataType
  • Constructor Details

    • Input

      public Input(org.apache.mina.core.buffer.IoBuffer buf)
      Creates Input object from byte buffer
      Parameters:
      buf - Byte buffer
  • Method Details

    • readDataType

      public byte readDataType()
      Reads the data type.
      Specified by:
      readDataType in interface Input
      Returns:
      One of AMF class constants with type
      See Also:
    • 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
    • bufferToString

      private final String bufferToString(byte[] str)
      Converts the bytes into a string.
      Parameters:
      str - string bytes
      Returns:
      decoded String
    • readDate

      public Date readDate()
      Returns a date
      Specified by:
      readDate in interface Input
      Returns:
      Date Decoded string object
    • readArray

      public Object readArray(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:
      target - target type
      Returns:
      array
    • readKeyValues

      public Map<String,Object> readKeyValues()
      Read key - value pairs. This is required for the RecordSet deserializer.
      Specified by:
      readKeyValues in interface Input
      Returns:
      key-value pairs
    • readKeyValues

      protected void readKeyValues(Map<String,Object> result)
      Read key - value pairs into Map object
      Parameters:
      result - Map to put resulting pair to
    • readMap

      public Object readMap()
      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)
      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(Object bean)
      Reads the input as a bean and returns an object
      Parameters:
      bean - Input as bean
      Returns:
      Decoded object
    • readSimpleObject

      protected Map<String,Object> readSimpleObject()
      Reads the input as a map and returns a Map
      Returns:
      Read map
    • readObject

      public Object readObject()
      Reads start object
      Specified by:
      readObject in interface Input
      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 separator
    • 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
    • readVectorInt

      public Vector<Integer> readVectorInt()
      Read Vector<int> object. This is not supported by the AMF0 deserializer.
      Specified by:
      readVectorInt in interface Input
      Returns:
      Vector<Integer> object
    • readVectorUInt

      public Vector<Long> readVectorUInt()
      Read Vector<Long> object. This is not supported by the AMF0 deserializer.
      Specified by:
      readVectorUInt in interface Input
      Returns:
      Vector<Long> object
    • readVectorNumber

      public Vector<Double> readVectorNumber()
      Read Vector<Number> object. This is not supported by the AMF0 deserializer.
      Specified by:
      readVectorNumber in interface Input
      Returns:
      Vector<Double> object
    • readVectorObject

      public Vector<Object> readVectorObject()
      Read Vector<Object> object. This is not supported by the AMF0 deserializer.
      Specified by:
      readVectorObject in interface Input
      Returns:
      Vector<Object> object
    • readReference

      public Object readReference()
      Reads Reference
      Specified by:
      readReference in interface Input
      Returns:
      Object Read reference to object
    • reset

      public void reset()
      Resets internals.
      Specified by:
      reset in interface Input
    • getPropertyType

      protected Type getPropertyType(Object instance, String propertyName)