3
3
public abstract class AppInfo {
4
4
protected byte buffer[];
5
protected String categories[]=new String[16];
6
protected boolean isCatRenamed[]=new boolean[16];
7
protected int catCount=0;
8
protected int dataOffset=0;
11
protected int lastUniqueID;
8
14
buffer=new byte[65535];
15
21
public abstract void setBuffer(byte[] b);
17
public byte[] getBuffer() {
23
public void parseCategories(){
24
bits=buffer[0]*256+buffer[1];
27
for (int i=0; i<16; i++) {
28
if (buffer[2+i*16]!=0) {
29
categories[i]=getStringAt(buffer,2+i*16);
30
//=new String(buffer,2+i*16,16);
32
//System.out.println("Got Category: \""+categories[i]+"\"");
37
if ( (bits&(1<<i))!=0) {
40
isCatRenamed[i]=false;
44
for (int i=0; i<4; i++) {
45
id[i]=Record.getLongAt(buffer,dataOffset);
48
lastUniqueID=buffer[dataOffset];
54
public void createDefaultBuffer() {
55
for (int i=0; i<buffer.length; i++) {
60
for (int i=0; i<16; i++) {
61
if (isCatRenamed[i]) {
64
if (categories[i]!=null) {
65
for (int ch=0;ch<16 && ch<categories[i].length();ch++) {
66
char z=categories[i].charAt(ch);
67
buffer[2+i*16+ch]=(byte)z;
71
buffer[0]=(byte) (bits>>256);
72
buffer[1]=(byte) (bits&256);
76
public abstract byte[] getBuffer() ;
77
public boolean isCatRenamed(int idx) {
78
return isCatRenamed[idx];
80
public void setCatRenamed(int idx,boolean b) {
84
public String getCatName(int idx) {
85
return categories[idx];
87
public void setCatName(int idx,String n){
94
public static String getStringAt(byte buffer[], int idx) {
96
while (idx<buffer.length && str.length()<16&&buffer[idx]!=0) {
98
str+=(char)buffer[idx];
104
public int getCatCount() {
108
public String toString() {
109
String out="Kategories";
110
for (int i=0; i<16; i++) {
111
out+=" "+categories[i];
112
if (isCatRenamed(i)) {