Package org.red5.io.amf
Class Output
- java.lang.Object
-
- org.red5.io.object.BaseOutput
-
- org.red5.io.amf.Output
-
- All Implemented Interfaces:
Output
- Direct Known Subclasses:
Output
public class Output extends BaseOutput implements Output
- Author:
- The Red5 Project, Luke Hubbard, Codegent Ltd (luke@codegent.com), Paul Gregoire (mondain@gmail.com), Harald Radi (harald.radi@nme.at)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.mina.core.buffer.IoBufferbufOutput bufferprotected static org.slf4j.Loggerlog-
Fields inherited from class org.red5.io.object.BaseOutput
refId, refMap
-
-
Constructor Summary
Constructors Constructor Description Output(org.apache.mina.core.buffer.IoBuffer buf)Creates output with given byte buffer
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.mina.core.buffer.IoBufferbuf()Return buffer of this Output objectprotected booleancheckWriteReference(Object obj)static voiddestroyCache()protected static byte[]encodeString(String string)Encode string.protected FieldgetField(Class<?> objectClass, String keyName)protected static net.sf.ehcache.CachegetFieldCache()protected MethodgetGetter(Class<?> objectClass, org.apache.commons.beanutils.BeanMap beanMap, String keyName)protected static net.sf.ehcache.CachegetGetterCache()protected static net.sf.ehcache.CachegetSerializeCache()protected static net.sf.ehcache.CachegetStringCache()booleanisCustom(Object custom)Whether object is customvoidputString(String string)static voidputString(org.apache.mina.core.buffer.IoBuffer buf, String string)Write out stringvoidreset()protected booleanserializeField(Class<?> objectClass, String keyName, Field field, Method getter)protected voidwriteArbitraryObject(Object object)Writes an arbitrary object to the output.voidwriteArray(Object array)Write primitive array.voidwriteArray(Object[] array)Write array.voidwriteArray(Collection<?> array)Write array.voidwriteBoolean(Boolean bol)Write booleanvoidwriteByteArray(ByteArray array)Write ByteArray object (AMF3 only).voidwriteCustom(Object custom)Write custom (user) objectvoidwriteDate(Date date)Write datevoidwriteMap(Collection<?> array)Write array as map.voidwriteMap(Map<Object,Object> map)Write map.voidwriteNull()voidwriteNumber(Number num)Write numbervoidwriteObject(Object object)Write object.voidwriteObject(Map<Object,Object> map)Write map as object.voidwriteRecordSet(RecordSet recordset)Write recordset.voidwriteReference(Object obj)Write reference to complex data typevoidwriteString(String string)Write stringvoidwriteVectorInt(Vector<Integer> vector)Write a Vector<int>.voidwriteVectorNumber(Vector<Double> vector)Write a Vector<Number>.voidwriteVectorObject(Vector<Object> vector)Write a Vector<Object>.voidwriteVectorUInt(Vector<Long> vector)Write a Vector<uint>.voidwriteXML(String xml)Convenience method to allow XML text to be used, instead of requiring an XML Document.voidwriteXML(Document xml)Write XML object-
Methods inherited from class org.red5.io.object.BaseOutput
clearReferences, getReferenceId, hasReference, 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.Output
clearReferences
-
-
-
-
Method Detail
-
isCustom
public boolean isCustom(Object custom)
Whether object is custom
-
checkWriteReference
protected boolean checkWriteReference(Object obj)
-
writeArray
public void writeArray(Collection<?> array)
Write array.- Specified by:
writeArrayin interfaceOutput- Parameters:
array- Array to write
-
writeArray
public void writeArray(Object[] array)
Write array.- Specified by:
writeArrayin interfaceOutput- Parameters:
array- Array to write
-
writeArray
public void writeArray(Object array)
Write primitive array.- Specified by:
writeArrayin interfaceOutput- Parameters:
array- Array to write
-
writeMap
public void writeMap(Collection<?> array)
Write array as map.
-
writeRecordSet
public void writeRecordSet(RecordSet recordset)
Write recordset.- Specified by:
writeRecordSetin interfaceOutput- Parameters:
recordset- Recordset to write
-
writeBoolean
public void writeBoolean(Boolean bol)
Write boolean- Specified by:
writeBooleanin interfaceOutput- Parameters:
bol- Boolean
-
writeCustom
public void writeCustom(Object custom)
Write custom (user) object- Specified by:
writeCustomin interfaceOutput- Parameters:
custom- Custom data type object
-
writeDate
public void writeDate(Date date)
Write date
-
writeNumber
public void writeNumber(Number num)
Write number- Specified by:
writeNumberin interfaceOutput- Parameters:
num- Number
-
writeReference
public void writeReference(Object obj)
Write reference to complex data type- Specified by:
writeReferencein interfaceOutput- Parameters:
obj- Referenced object
-
writeObject
public void writeObject(Object object)
Write object.- Specified by:
writeObjectin interfaceOutput- Parameters:
object- Object to write
-
serializeField
protected boolean serializeField(Class<?> objectClass, String keyName, Field field, Method getter)
-
getGetter
protected Method getGetter(Class<?> objectClass, org.apache.commons.beanutils.BeanMap beanMap, String keyName)
-
writeObject
public void writeObject(Map<Object,Object> map)
Write map as object.- Specified by:
writeObjectin interfaceOutput- Parameters:
map- Map to write
-
writeArbitraryObject
protected void writeArbitraryObject(Object object)
Writes an arbitrary object to the output.- Parameters:
object- Object to write
-
writeString
public void writeString(String string)
Write string- Specified by:
writeStringin interfaceOutput- Parameters:
string- String
-
writeByteArray
public void writeByteArray(ByteArray array)
Write ByteArray object (AMF3 only).- Specified by:
writeByteArrayin interfaceOutput- Parameters:
array- object to write
-
writeVectorInt
public void writeVectorInt(Vector<Integer> vector)
Write a Vector<int>.- Specified by:
writeVectorIntin interfaceOutput- Parameters:
vector- vector
-
writeVectorUInt
public void writeVectorUInt(Vector<Long> vector)
Write a Vector<uint>.- Specified by:
writeVectorUIntin interfaceOutput- Parameters:
vector- vector
-
writeVectorNumber
public void writeVectorNumber(Vector<Double> vector)
Write a Vector<Number>.- Specified by:
writeVectorNumberin interfaceOutput- Parameters:
vector- vector
-
writeVectorObject
public void writeVectorObject(Vector<Object> vector)
Write a Vector<Object>.- Specified by:
writeVectorObjectin interfaceOutput- Parameters:
vector- vector
-
encodeString
protected static byte[] encodeString(String string)
Encode string.- Parameters:
string- string to encode- Returns:
- encoded string
-
putString
public static void putString(org.apache.mina.core.buffer.IoBuffer buf, String string)Write out string- Parameters:
buf- Byte buffer to write tostring- String to write
-
writeXML
public void writeXML(Document xml)
Write XML object
-
writeXML
public void writeXML(String xml)
Convenience method to allow XML text to be used, instead of requiring an XML Document.- Parameters:
xml- xml to write
-
buf
public org.apache.mina.core.buffer.IoBuffer buf()
Return buffer of this Output object- Returns:
- Byte buffer of this Output object
-
reset
public void reset()
-
getStringCache
protected static net.sf.ehcache.Cache getStringCache()
-
getSerializeCache
protected static net.sf.ehcache.Cache getSerializeCache()
-
getFieldCache
protected static net.sf.ehcache.Cache getFieldCache()
-
getGetterCache
protected static net.sf.ehcache.Cache getGetterCache()
-
destroyCache
public static void destroyCache()
-
-