Results 1 to 3 of 3
- 01-28-2008, 12:39 PM #1
Member
- Join Date
- Jan 2008
- Posts
- 1
- Rep Power
- 0
Copy a .swf file from server side to client using signed applet
Hello to all Java Code Masters out thr,
I am trying to copy a .swf file from server side to client side, however I am unsuccessful in writing the correct data. By correct data I mean that , the data does gets saved on the client side in the .swf file, and the size of the .swf file on client side is as expected, but some how I don't know why the data is not the same as expected.
I tried opening up both the swf file, one which is on server side and the other which is on client side. And both looked different in the notepad.
When I opens up the client side .swf file on browser it shows nothing while the .swf file on server side worked fine.
Here is a snap shot of the two .swf files when opened in notepad:
clientside.swf
serverside.swfJava Code:坃ࡓ죃鱸뷤瀉ᡚ穸s歒斷뛉쭬ⶲ뉯緤░뉋쭬틲毳띵뺤畮祮釯烉쉍‼➀Ƿℵ㼤ꦅ㼌⡉⁈ș㖩䈼ꦓɊጵꨘ妆ၸ쇠鳳ﯯ龜괯䪅쿾칿칷컹緶履殖㋿罣쯻杬懨E翂䶙幷鿠︡拡ﬦ댨꾖政ᯋὣꯤ糥䧩缿䨗捫嶺깼瘶羋⯞勹쪾癞ঞ頁韧롻ⱖ撯貊攗閩㫙↳萰Ⳁ⼈쳂荡᧰ﻶ顠鸎싔㿄㰧柂䪄러䂀좹㏠ꕊ㌏힟䘜㦴⌙⍈㽾ꙴ㿯렑㽔
serverside.swf is what I expect to be saved, but clientside.swf is what i get.Java Code:CWS x pZxzSRkeɶl˲-o}%Kl*]kununyypM< '5!$I (H 5<B J5Yx/*J߫w} k2clga\%
Below is a code snippet which I am trying :
In above code I am trying to write the string swfcontent, which contains the data shown above in serverside.swf, to clientside.swf.Java Code:public void writeswftoclient(String swfcontent) { String userHome = System.getProperty("user.home" ); String ImoracleDirectory = userHome + "\\MyFolder"; File fdirectory = new File(ImoracleDirectory); if(!fdirectory.isDirectory()) { fdirectory.mkdir(); } String playlist = ImoracleDirectory + "\\clientside.swf"; File fplaylist = new File(playlist); try { Writer output = null; output = new BufferedWriter(new FileWriter(fplaylist,true)); *System.out.println(swfcontent);* *output.write(swfcontent);* output.close(); } catch (Exception e) { System.out.println("Cannot create or write to the playlist"); } }
Interesting thing is that I am doing System.out.println(swfcontent); just before writing the data to clientside.swf using output.write(swfcontent);. And System.out.println does print the write data on the java console. However I dont know out of what reason the data doesnt get written correctly on the client's computer.
Kindly help me in this plzzzzzzzzzz.
PS: I tried saving a javascript file from server to client and it was saved successfully, with data as expected on the client side.
May be because the javascripts contained plain test like : document.write() while the .swf file contains raw binary data.
Kindly throw some light on it and help me get through this.
I even tried with the following manner:
but with no success. :(Java Code:public void writeswftoclient(String swfcontent) { String userHome = System.getProperty("user.home" ); String ImoracleDirectory = userHome + "\\MyFolder"; File fdirectory = new File(ImoracleDirectory); if(!fdirectory.isDirectory()) { fdirectory.mkdir(); } String playlist = ImoracleDirectory + "\\clientside.swf"; File fplaylist = new File(playlist); try { FileOutputStream out = new FileOutputStream(new File(playlist)); out.write(swfcontent.getBytes()); out.close(); } catch (Exception e) { System.out.println("Cannot create or write to the playlist"); } }
One more thing I just noticed is that though the size of swf file on client side and server side seems to be same i.e. 33 Kb. But when I tried to see thr sizes in bytes by right click --> properties , The size of .swf file on client side is: 33200 while the size of .swf on server side is 33477.
Kindly help me
- 10-05-2008, 06:11 PM #2
Member
- Join Date
- Oct 2008
- Posts
- 68
- Rep Power
- 0
I think this could be related to unicode ...as your file contains the non english characters....and this language characters seems to be multibyte...so try to use some stream which can writer multibyte stream.....writing plain bytes may be the issue
- 10-05-2008, 06:13 PM #3
Member
- Join Date
- Oct 2008
- Posts
- 68
- Rep Power
- 0
Similar Threads
-
To transfer a file from client to server
By phani in forum NetworkingReplies: 4Last Post: 10-12-2010, 06:15 PM -
send file via client - server model
By spasavvas in forum NetworkingReplies: 15Last Post: 08-13-2010, 11:45 AM -
jsp program for client side printer to print these 2 strings on 3/3
By for453 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 08-07-2007, 04:42 PM -
i want how to make aprint client side printer to print these 2 strings on 3/3 inch pa
By for453 in forum NetworkingReplies: 0Last Post: 08-06-2007, 06:54 PM -
How to implement secure connection(HTTPs) in client side
By vicky in forum NetworkingReplies: 6Last Post: 07-18-2007, 03:15 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks