Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-28-2008, 01:39 PM
Member
 
Join Date: Jan 2008
Posts: 1
Imoracle is on a distinguished road
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
Code:
坃ࡓ죃鱸뷤瀉�ᡚ穸s歒斷뛉쭬ⶲ뉯緤░뉋쭬틲��毳띵뺤畮祮୹釯烉쉍‼➀Ƿℵ㼤ꦅ㼌⡉⁈ș㖩䈼ꦓɊጵꨘ妆ၸ쇠鳳ﯯ龜괯䪅�쿾칿칷컹緶履殖㋿罣쯻杬�懨�E�翂䶙幷鿠︡拡ﬦ댨꾖政ᯋὣꯤ糥䧩缿䨗捫嶺깼瘶羋⯞勹쪾癞ঞ頁韧୘롻ⱖ撯貊攗閩㫙↳萰Ⳁ⼈쳂荡᧰ﻶ顠꓈鸎싔㿄㰧柂䪄러䂀좹㏠ꕊ㌏힟䘜㦴⌙⍈㽾ꙴ㿯렑㽔
serverside.swf
Code:
CWS x pZxzSRkeɶl˲-o}%Kl*]kununyy pM< '5!$ I (H  5<B J5Yx/*J߫w} k2clga\%
serverside.swf is what I expect to be saved, but clientside.swf is what i get.

Below is a code snippet which I am trying :

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"); } }
In above code I am trying to write the string swfcontent, which contains the data shown above in serverside.swf, to clientside.swf.

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:

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"); } }
but with no success.

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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
send file via client - server model spasavvas Networking 5 05-29-2008 10:37 PM
To transfer a file from client to server phani Networking 1 04-16-2008 02:39 AM
jsp program for client side printer to print these 2 strings on 3/3 for453 JavaServer Pages (JSP) and JSTL 0 08-07-2007 05:42 PM
i want how to make aprint client side printer to print these 2 strings on 3/3 inch pa for453 Networking 0 08-06-2007 07:54 PM
How to implement secure connection(HTTPs) in client side vicky Networking 6 07-18-2007 04:15 PM


All times are GMT +3. The time now is 05:49 AM.


VBulletin, Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2006 - 2007, www.java-forums.org