In mail.java-linux Thomas Okken <[EMAIL PROTECTED]> writes:
>I'm working on something that requires a static array of almost 400k.
>I figured that the best way to initialize this array would be to
>compress the data, add a static array with an initializer to put the
>compressed data there (gzip compresses it to about 22k, which seems
>reasonable), and then add a static {} block that uses java.util.zip
>to decompress this data.
> private static final byte myGzippedData =
> {
> 31, -117, 8, 8, -3, -3, 14, 54, 0, 3, 97, 0, -19, 93, 11,
> -126, -37, -86, 14, -35, 42, 60, 46, -39, -1, 18, -34, 88, 31,
> // and so on and so on... 22426 bytes in all
> }
The jar file suggestions may be better for you but I wondered
if I could get binary data without lots of code being generated and
came up with this:
public class bigarray {
private static final String myGzippedData = "\001\002\003\000\004\005";
public static void main(String[] args) {
System.out.println("Len="+myGzippedData.length());
}
}
I didn't check for length restrictions on the String.
Andy
--
Andrew Burgess
[EMAIL PROTECTED]
Available for software contract work: www.scruz.net/~cichlid