Re: Getting Applet into Flash ROM?

zer0flag <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hi Mark!

Thank you very much for your help! I like this approach! Maybe it's not 
as elegant and efficient as the solution in assembler, but the 
filesystem is built only once at startup so it should be enough for most 
of us.
I just wanted to ask you how you put the string into Java. Just copy and 
paste from a text editor or do I have to make some special preparations? 
What about encoding? Thanks once again for your help!

Best regards,
Anguel

Mark Wolforth wrote:

>
> Hi,
>
> I've done this entirely in Java by storing the data as a string and 
> then using the getBytes() method to extract the bytes back.  A String 
> is the most data efficient way to do this in Java since all other 
> array types add code to set up the array itself.  As an example, you 
> could have a class like:
>
> class Web_applet {
>    public byte[] JARfile;
>    public web_applet() {
>    try {
>        JARfile = "­-Þd;o³õÃݶ¡¸Ç6ï´ÍÀ»l'bض\u0".getBytes();
>    } catch (Throwable _) {}
>    }
> }
>
> and then extract the data with something like:
>
> private static final void CreateAppletJAR() {
>    FileOutputStream jarfile;
>    try {
>        jarfile = new FileOutputStream (new File("Applet.jar"));
>        Web_applet applet = new Web_applet();
>        jarfile.write (applet.JARfile, 0, applet.JARfile.length);
>        jarfile.close();
>    } catch (Throwable t) {
>        System.out.println ("Error creating web applet JAR file.");
>        System.out.println (t);
>    }
> }  // End of CreateAppletJAR()
>
> Watch out for the 64K class limit size.  If you hit up against this 
> you'll need to create multiple classes to hold your data.
>
> Good luck,
> Mark.
>
>
> _______________________________________________
> TINI mailing list
> TINI-6tN4nzCoH/[email protected]
> To UNSUBSCRIBE, edit your profile, or see list archives:
> http://lists.dalsemi.com/mailman/listinfo/tini
>
>

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.