简体   繁体   中英

Java library to encode / decode AMF

I currently have a Java server that talks to a Flash client by passing JSON encoded data over a binary socket connection. Is there a way on either side to encode / decode packets as AMF instead of JSON? It seems to me that there should be some native support in Flash player for doing this? All the implementations I have found of AMF serialization seem to be embedded inside an application framework.

Simiarly so, does anyone know if it's possible to decode AMF packets independently of a connection implementation in Flash?

You can use OpenAMF's AMFDeserializer class,

http://www.openamf.com/javadocs/org/openamf/io/AMFDeserializer.html

You can also use the relevant classes in RED5 and BlazeDS.

AMF stands for Actionscript Messaging Format and is supported by the flash player itself out of the box. For the Java side, I'm sure there's some library already written. Red 5 is an open Flash Server written in Java that supports AMF, so you could check it out.

PS:

Looks like AMF serialization / deserialization is dealt with in this package (red 5 code): http://red5.googlecode.com/svn/java/server/tags/0_9rc1/src/org/red5/io/amf/ . Not sure if there's a nice standalone API for this, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM