How to send binary data from AS3 through Java to a filesystem?

后端 未结 2 402
余生分开走
余生分开走 2021-01-24 11:33

I\'ve got XML data in AS3 that needs to be compressed, validated on my Java Google App Engine servlet then saved to a file in Google Cloud Storage. Later that file will be opene

2条回答
  •  耶瑟儿~
    2021-01-24 12:14

    Here is the code that I use to save an xml. I send the data to PHP but I would think it would work the same way for you... I haven't had any trouble with it.

    var createXMLURL:URLRequest = new URLRequest("createXML.php");
    createXMLURL.method = URLRequestMethod.POST;
    var Variables:URLVariables = new URLVariables();
    Variables.xmlString = xml.toXMLString();
    Variables.filename = filename;
    createXMLURL.data = Variables;
    var loader:URLLoader = new URLLoader();
    loader.dataFormat = "VARIABLES";
    loader.addEventListener(Event.COMPLETE, xmlCreated);
    loader.load(createXMLURL);
    

    Let me know if you have any questions about what some of the variables are since I did not include their declarations (I think they are pretty easy to figure out).

    Now this doesn't send that data in binary format like you were asking for, but I don't know why you wouldn't be able to convert the string to binary once you receive it in java if you really need the raw bytes.

提交回复
热议问题