import java.io.*; @author BorderFol // RLE compress algorithm J2ME implementation by BorderFol public final class RLEPacker { public static int[] comp(int[] in){ int newByte, oldByte; byte incr; final int len = in.length; NBuffer incrBuff = new NBuffer(); oldByte = in[0]; incr++; for(int i=1;i 0){ incrBuff.add(incr & 0xFF); incr = 0; } incr--; } oldByte = newByte; } final int size = incrBuff.size; int pos = 0; int value = 0; final NBuffer buf = new NBuffer(); for(int i=0;i 0){ value = in[pos]; pos += incr; for(j=0;j= size){ ext(); } buf[pos++] = n; } public void ext(){ final int[] tmp = new int[size + 1]; System.arraycopy(buf, 0, tmp, 0, size; buf = tmp; size++; } } }