• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Images visible

 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there any way to hide the images in the jar file just as we obfuscate the class files ?

Regards,
Arijit
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not think you can. But you place the images on a server and use an authentication scheme to protect it. The MIDlet downloads the images at runtime.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can, you need to write a program to put your images and name/size data into a binary data file and another file to teach your MIDLet how to read them back. Many games on the internet are doing that. If you download one, except a logo, you see no images, but when you play it, all images are showing up.
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael...

Well yes .. I can always do the server stuff but I was hoping that we could hide it when we send it off in JAR file.

Roaseanne.... need a little more clarification.. any sample codes that you can share ?

So basically I need to create 2 more files apart from the standard ones that I create. I also need to modify the MIDlt to read th images.

Some sample code please. Or some link which explains in detail.

Thanks,
Arijit
 
Michael Yuan
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Roseanne's idea would work. But you need to know how PNG images files are structured to make it work. The image file is essentially an array of bytes with headers. You can write a program to write all odd numbered items in the array first and then the even numbered items. People will not be able to read your scrambled images but your MIDlet can put the bytes back to their original orders at runtime.
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Michael.. that was helpful..

Regards,
Arijit
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ideally for a commercial product.. will it affect the speed or any other features ?

I will need to unscramble first before I can use the API methods .. right Is it advisable to do that ?


Regards,
Arijit
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you don't have to seperate the even/odd bytes, that would affect the speed. You don't need to know the png file structure either.

You just still use the same InputStream methods to read everything back, the only thing you need to know is where to start read, where to finish. Those are your companies convention, you should not let anyone else to know. For the same reason, I cannot give you sample code.

Be creative, that is it!!!
reply
    Bookmark Topic Watch Topic
  • New Topic