Created
July 16, 2009 20:25
-
-
Save narkisr/148668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public <T> String toAmf(final T source) throws IOException { | |
final StringBuffer buffer = new StringBuffer(); | |
final ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
final Provider<SerializationContext> provider = new SerializationContextProvider();// creating the provider | |
final Amf3Output amf3Output = new Amf3Output(provider.get());// creating the context instance | |
amf3Output.setOutputStream(bout); | |
amf3Output.writeObject(source); | |
amf3Output.flush(); | |
amf3Output.close(); | |
final BASE64Encoder encoder = new BASE64Encoder(); | |
return encoder.encode(bout.toByteArray()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment