Slt tous le monde
j ai un problem de lire un attribut de type Byte[] (tableau de bit)
le problem c est j arrive pas à lire la taille du tableau.
classe Introspection:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 import java.lang.reflect.Field; import java.lang.reflect.Array; import java.io.*; public class Introspection { private Field[] fields; public Introspection(String file){ fields=this.getClass().getDeclaredFields(); this.file=file; } public void set(){ try{ for(int i=0;i<fields.length;i++){ if(fields[i].getType().getSimpleName().equals("Integer")){ fields[i].set(this, 1); } if(fields[i].getType().getName().equals("[Ljava.lang.Byte;")){ fields[i].set(this, ); } } } catch(IllegalAccessException e){ System.out.println(e.getMessage()); } } Classe Ticket: public class Ticket extends Introspection { public Integer RecordLength; public Byte ServiceKey[]=new Byte[10]; }
