IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

avec Java Discussion :

probleme avec fonction concatenation de tableaux


Sujet :

avec Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    80
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 80
    Par défaut probleme avec fonction concatenation de tableaux
    bonjour tt le monde j ai ce pti bout de code et je voudrai savoir comment insérer ma fonction de concatenage pour concatener les 3 tableaux que j ai générés :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
     
    import java.io.*;
    import java.util.*;
    import java.util.zip.*;
     
     
    public class  GenererFMI_224_1{
     
     
     
     
    	public static void main(String[] args){
    		ByteArrayOutputStream bos=new ByteArrayOutputStream();
    		int byteLu;
    		byte[] tab =new byte[105];
    		//ecriture dans le tampon
    		try{
     
    			bos.write((byte)0x03);//-----number of structures = -------//
     
     
    			//1er Structure
    			bos.write((byte)0x01);//-------type(0) = 1 = fragment management info -------
     
    			bos.write((byte)0x00);//--------f_m_info_id = 0 ------------
     
    			bos.write((byte)0x00); //----------ptr_fm_info= 25-------------//
    			bos.write((byte)0x00);//--------------------------------------------//
    			bos.write((byte)0x19);//-------------------------------------------//
     
    			bos.write((byte)0x00);//---------length_fm_info = 42 -------//
    			bos.write((byte)0x00);//----------------------------------------//
    			bos.write((byte)0x32);//---------------------------------------//
     
     
     
     
    			//2eme tructure 
    			bos.write((byte)0x02);//-----type(1) = 2---> DataRepository
    			bos.write((byte)0x00);//-----DR_id(1) = 0----------
     
    			bos.write((byte)0x00);//---------------ptr_DataRepository = 67-------------------//
    			bos.write((byte)0x00);//-------------------------------------------------------//
    			bos.write((byte)0x4B);//-------------------------------------------------------//
     
    			bos.write((byte)0x00);//--------length_DataRepository = 139 ----------------------//
    			bos.write((byte)0x09);//-----------------------------------------------------//
    			bos.write((byte)0x96);//-----------------------------------------------------//
     
     
    			//3eme Structure
    			bos.write((byte)0xE0);//-----------------ESG_data_repository
    			bos.write((byte)0x00);//----------------ESG_dr_id
     
    			bos.write((byte)0x00);//----------- ptr_ESG_dr = 194
    			bos.write((byte)0x09);//----------------------------------
    			bos.write((byte)0xE1);// ------------------------------
     
     
    			bos.write((byte)0x00);//-------length_ESG_dr = 10435 
    			bos.write((byte)0x00);//------------------------------------
    			bos.write((byte)0x5A);//-----------------------------------
     
     
    			}
     
    			//byte []  frg1=getFragmentManagement();
    			//byte []  frg2=getDataRepository();
    			//byte []  frg3=getESGDataRepository();
     
     
     
     
     
     
     
    		/*FileOutputStream fos = null;
     
    			fos = new FileOutputStream("ESGpartitionDeclaration.bin");
    			//fos.write(res); // zipé
    			fos.write(tab); // pas zippé
    			fos.close();
    		}*/
    		catch (Exception e)
    		{
    			e.printStackTrace();
    		}
    		finally
    		{
    			// On ferme le flux
     
    		}
     
     
     
    	}
     
     
    	/*public static byte[] gzip(byte[] ungzipped) throws IOException {
     
            final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
            final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes);
            gzipOutputStream.write(ungzipped);
            gzipOutputStream.close();
            return bytes.toByteArray();*/
     
     
     
     
    public static byte [] getFragmentManagement()
    	{
    	byte [] tab= new byte [50];
     
    	tab[0]=	(byte)0xFF;
    	tab[1]=	(byte)0x21;
    	tab[2]=	(byte)0x00;
    	tab[3]=	(byte)0x00;
    	tab[4]=	(byte)0x00;
    	tab[5]=	(byte)0x00;
    	tab[6]=	(byte)0x00;
    	tab[7]=	(byte)0x00;
    	tab[8]=	(byte)0x00;
    	tab[9]=	(byte)0x02;
     
    	tab[10]=(byte)0x00;
    	tab[11]=(byte)0x00;
    	tab[12]=(byte)0x00;
    	tab[13]=(byte)0x16;
    	tab[14]=(byte)0x00;
    	tab[15]=(byte)0x00;
    	tab[16]=(byte)0x00;
    	tab[17]=(byte)0x03;
    	tab[18]=(byte)0x00;
    	tab[19]=(byte)0x00;
    	tab[20]=(byte)0x00;
     
    	tab[21]=(byte)0x2C;
    	tab[22]=(byte)0x00;
    	tab[23]=(byte)0x00;
    	tab[24]=(byte)0x00;
    	tab[25]=(byte)0x04;
    	tab[26]=(byte)0x00;
    	tab[27]=(byte)0x00;
    	tab[28]=(byte)0x00;
    	tab[29]=(byte)0x42;
     
    	tab[30]=(byte)0x00;
    	tab[31]=(byte)0x00;
    	tab[32]=(byte)0x00;
    	tab[33]=(byte)0x05;
    	tab[34]=(byte)0x00;
    	tab[35]=(byte)0x00;
    	tab[36]=(byte)0x00;
    	tab[37]=(byte)0x4A;
    	tab[38]=(byte)0x00;
    	tab[39]=(byte)0x00;
     
    	tab[40]=(byte)0x00;
    	tab[41]=(byte)0x06;
    	tab[42]=(byte)0x00;
    	tab[43]=(byte)0x00;
    	tab[44]=(byte)0x00;
    	tab[45]=(byte)0x52;
    	tab[46]=(byte)0x00;
    	tab[47]=(byte)0x00;
    	tab[48]=(byte)0x00;
    	tab[49]=(byte)0x00;
    	tab[50]=(byte)0x07;
     
     
     
    	return tab;
     
    	}
     
     
    public static byte [] getDataRepository()
    		{	
    		try {	RandomAccessFile raf= new RandomAccessFile ("Result_221.1.dat", "r");
    			boolean fin=false;
    			int i=0;
    			raf.seek(50);
    			byte [] tab = new byte[2454];
    			int n=raf.read(tab);
    			System.out.println("buffer length "+n);
    				//bb[0]=b;
    				//System.out.print(new String (bb));
    				//i++;
     
    				//byte [] buffer=new byte[9407];
    			        //int n= raf8.read(buffer);
    			        //System.out.println("GZIP Buffer of length "+n);
    				//byte tab[]= new byte [9407 -964];
    			        //System.arraycopy(buffer,964, tab,0,(9407-964));
    			        //System.arraycopy(bb,0, buffer,51,(10000-35));	
    			return tab;	}
    		catch (Exception e)
    		{
    			e.printStackTrace();
    		}
    		return null;
    	}
     
     
     
    public static byte[] getESGDataRepository()
    	{
    	byte[] tab= new byte [50];
     
    //00 00 13 00 23 10 f0 39 0 0 c3 c0 84 04 34 34 1c 1c 68 5c 87 83 00 84 13 00 23 10 f0 39 00 01 43 c0 84 04 34 34 1c 1c 5
     
     
     
     
    	tab[0]=(byte)0x00;
    	tab[1]=(byte)0x00;
    	tab[2]=(byte)0x13;
    	tab[3]=(byte)0x00;
    	tab[4]=(byte)0x23;
    	tab[5]=(byte)0x10;
    	tab[6]=(byte)0xF0;
    	tab[7]=(byte)0x39;
    	tab[8]=(byte)0x00;
    	tab[9]=(byte)0x00;
     
    	tab[10]=(byte)0xC3;
    	tab[11]=(byte)0xC0;
    	tab[12]=(byte)0x84;
    	tab[13]=(byte)0x04;
    	tab[14]=(byte)0x34;
    	tab[15]=(byte)0x34;
    	tab[16]=(byte)0x1C;
    	tab[17]=(byte)0x1C;
    	tab[18]=(byte)0x68;
    	tab[19]=(byte)0x5C;
    	tab[20]=(byte)0x87;
     
    	tab[21]=(byte)0x83;
    	tab[22]=(byte)0x00;
    	tab[23]=(byte)0x84;
    	tab[24]=(byte)0x13;
    	tab[25]=(byte)0x00;
    	tab[26]=(byte)0x23;
    	tab[27]=(byte)0x10;
    	tab[28]=(byte)0xF0;
    	tab[29]=(byte)0x39;
     
    	tab[30]=(byte)0x00;
    	tab[31]=(byte)0x01;
    	tab[32]=(byte)0x43;
    	tab[33]=(byte)0xC0;
    	tab[34]=(byte)0x84;
    	tab[35]=(byte)0x04;
    	tab[36]=(byte)0x34;
    	tab[37]=(byte)0x34;
    	tab[38]=(byte)0x1C;
    	tab[39]=(byte)0x1C;
     
    //c 87 83 01 08 13 00 23 10 f0 39 00 00 43 c0 84 04 34 34 1c 1c 68 5c 87 83 01 8a 05 00 25 10 02 1f 04 8e 05 00 25 10 
     
    //02 1f 07 12 05 00 25 10 02 1f
     
    	tab[40]=(byte)0x05;
    	tab[41]=(byte)0x0C;
    	tab[42]=(byte)0x87;
    	tab[43]=(byte)0x83;
    	tab[44]=(byte)0x01;
    	tab[45]=(byte)0x08;
    	tab[46]=(byte)0x13;
    	tab[47]=(byte)0x00;
    	tab[48]=(byte)0x23;
    	tab[49]=(byte)0x10;
    	tab[50]=(byte)0xF0;
    	tab[51]=(byte)0x39;
     
    	tab[52]=(byte)0x00;
    	tab[53]=(byte)0x00;
    	tab[54]=(byte)0x43;
    	tab[55]=(byte)0xC0;
    	tab[56]=(byte)0x84;
    	tab[57]=(byte)0x04;
    	tab[58]=(byte)0x34;
    	tab[59]=(byte)0x34;
    	tab[60]=(byte)0x1C;
     
    	tab[61]=(byte)0x1C;
    	tab[62]=(byte)0x68;
    	tab[63]=(byte)0x5C;
    	tab[64]=(byte)0x87;
    	tab[65]=(byte)0x83;
    	tab[66]=(byte)0x01;
    	tab[67]=(byte)0x8A;
    	tab[68]=(byte)0x05;
    	tab[69]=(byte)0x00;
    	tab[70]=(byte)0x25;
    	tab[71]=(byte)0x10;
     
    	tab[72]=(byte)0x02;
    	tab[73]=(byte)0x1F;
    	tab[74]=(byte)0x04;
    	tab[75]=(byte)0x8E;
    	tab[76]=(byte)0x05;
    	tab[77]=(byte)0x00;
    	tab[78]=(byte)0x25;
    	tab[79]=(byte)0x10;
    	tab[80]=(byte)0x02;
     
    	tab[81]=(byte)0x1F;
    	tab[82]=(byte)0x07;
    	tab[83]=(byte)0x12;
    	tab[84]=(byte)0x05;
    	tab[85]=(byte)0x00;
    	tab[86]=(byte)0x25;
    	tab[87]=(byte)0x10;
    	tab[88]=(byte)0x02;
    	tab[89]=(byte)0x1F;
     
    	tab[90]=(byte)0x1F;
     
     
    	return tab;
     
    }
     
    public Object[] concat(Object[] tab1, Object[] tab2, Object[] tab3){
            Object[] tabResult = new Object[tab1.length + tab2.length + tab3.length];
            int count = 0;
            System.arraycopy(tab1,0,tabResult,0,tab1.length);
            System.arraycopy(tab2,0,tabResult,tab1.length,tab2.length);
    	System.arraycopy(tab3,0,tabResult,(tab1.length + tab2.length));
            return tabResult;
        }
     
     
    };
    meric je voudrai savoir comment appeler cette fonction en lui donnat comme entrées les resultats des fonctions de génération..est-ce possible?

    merci

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    80
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 80
    Par défaut
    Citation Envoyé par morph41 Voir le message
    Bonjour, simplement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    byte[] result = concat(tab, getFragmentManagement(), 
    getDataRepository()
    );
    Mais il faudrait changer concat pour utiliser des byte[] au lieu de Object[].
    faut juste que je change le type ou faut ke j me refere a la doc?? encore merci pr ta reponse

  3. #3
    Membre Expert
    Avatar de CheryBen
    Inscrit en
    Mai 2005
    Messages
    1 599
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 599
    Par défaut
    J'ai supprimé mon précédent message car System.arraycopy n'est pas applicables à un tableau de byte.

    Je pense que tu devrais toi-même concaténer les tableaux en faisant des boucles, sans utiliser la fonction de systeme qui ne petu pas manipuler les byte.

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    80
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 80
    Par défaut
    Citation Envoyé par morph41 Voir le message
    J'ai supprimé mon précédent message car System.arraycopy n'est pas applicables à un tableau de byte.

    Je pense que tu devrais toi-même concaténer les tableaux en faisant des boucles, sans utiliser la fonction de systeme qui ne petu pas manipuler les byte.
    merci morph41 j ai essayé de faire ca..dis moi ca peut marcher a ton avis?

    et comment faire pour recuperer le resultat final dans un fichier par exemple "septembre.bin"

    merci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    public byte[] concat(byte[] tab1, byte[] tab2, byte[] tab3){
            byte[] tabResult = new Object[tab1.length + tab2.length + tab3.length];
            int count = 0;
            for(int i=0; i<tab1.length; i++)
                tabResult[count++] = tab1[i];
            for(int i=0; i<tab2.length; i++)
                tabResult[count++] = tab2[i];
    	for(int i=0; i<tab3.length; i++)
                tabResult[count++] = tab3[i];
            return tabResult;
        }
     
    	byte[] result = concat(tab, getFragmentManagement(), getDataRepository());

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    80
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 80
    Par défaut
    encore une chose comment je pourrai crée un flux binaire de sortie et y adjoindre les entrées ke j ai inséreés manuellement :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    try{
     
    			bos.write((byte)0x03);//-----number of structures = -------//
     
     
    			//1er Structure
    			bos.write((byte)0x01);//-------type(0) = 1 = fragment management info -------
     
    			bos.write((byte)0x00);//--------f_m_info_id = 0 ------------
     
    			bos.write((byte)0x00); //----------ptr_fm_info= 25-------------//
    			bos.write((byte)0x00);//--------------------------------------------//
    			bos.write((byte)0x19);//-------------------------------------------//
     
    			bos.write((byte)0x00);//---------length_fm_info = 42 -------//
    			bos.write((byte)0x00);//----------------------------------------//
    			bos.write((byte)0x32);//---------------------------------------//
     
     
     
     
    			//2eme tructure 
    			bos.write((byte)0x02);//-----type(1) = 2---> DataRepository
    			bos.write((byte)0x00);//-----DR_id(1) = 0----------
     
    			bos.write((byte)0x00);//---------------ptr_DataRepository = 67-------------------//
    			bos.write((byte)0x00);//-------------------------------------------------------//
    			bos.write((byte)0x4B);//-------------------------------------------------------//
     
    			bos.write((byte)0x00);//--------length_DataRepository = 139 ----------------------//
    			bos.write((byte)0x09);//-----------------------------------------------------//
    			bos.write((byte)0x96);//-----------------------------------------------------//
     
     
    			//3eme Structure
    			bos.write((byte)0xE0);//-----------------ESG_data_repository
    			bos.write((byte)0x00);//----------------ESG_dr_id
     
    			bos.write((byte)0x00);//----------- ptr_ESG_dr = 194
    			bos.write((byte)0x09);//----------------------------------
    			bos.write((byte)0xE1);// ------------------------------
     
     
    			bos.write((byte)0x00);//-------length_ESG_dr = 10435 
    			bos.write((byte)0x00);//------------------------------------
    			bos.write((byte)0x5A);//-----------------------------------
     
     
    			}
    et aussi le contenu des autres tableaux :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
     
    public static byte [] getFragmentManagement()
    	{
    	byte [] tab= new byte [50];
     
    	tab[0]=	(byte)0xFF;
    	tab[1]=	(byte)0x21;
    	tab[2]=	(byte)0x00;
    	tab[3]=	(byte)0x00;
    	tab[4]=	(byte)0x00;
    	tab[5]=	(byte)0x00;
    	tab[6]=	(byte)0x00;
    	tab[7]=	(byte)0x00;
    	tab[8]=	(byte)0x00;
    	tab[9]=	(byte)0x02;
     
    	tab[10]=(byte)0x00;
    	tab[11]=(byte)0x00;
    	tab[12]=(byte)0x00;
    	tab[13]=(byte)0x16;
    	tab[14]=(byte)0x00;
    	tab[15]=(byte)0x00;
    	tab[16]=(byte)0x00;
    	tab[17]=(byte)0x03;
    	tab[18]=(byte)0x00;
    	tab[19]=(byte)0x00;
    	tab[20]=(byte)0x00;
     
    	tab[21]=(byte)0x2C;
    	tab[22]=(byte)0x00;
    	tab[23]=(byte)0x00;
    	tab[24]=(byte)0x00;
    	tab[25]=(byte)0x04;
    	tab[26]=(byte)0x00;
    	tab[27]=(byte)0x00;
    	tab[28]=(byte)0x00;
    	tab[29]=(byte)0x42;
     
    	tab[30]=(byte)0x00;
    	tab[31]=(byte)0x00;
    	tab[32]=(byte)0x00;
    	tab[33]=(byte)0x05;
    	tab[34]=(byte)0x00;
    	tab[35]=(byte)0x00;
    	tab[36]=(byte)0x00;
    	tab[37]=(byte)0x4A;
    	tab[38]=(byte)0x00;
    	tab[39]=(byte)0x00;
     
    	tab[40]=(byte)0x00;
    	tab[41]=(byte)0x06;
    	tab[42]=(byte)0x00;
    	tab[43]=(byte)0x00;
    	tab[44]=(byte)0x00;
    	tab[45]=(byte)0x52;
    	tab[46]=(byte)0x00;
    	tab[47]=(byte)0x00;
    	tab[48]=(byte)0x00;
    	tab[49]=(byte)0x00;
    	tab[50]=(byte)0x07;
     
     
     
    	return tab;
     
    	}
     
     
    public static byte [] getDataRepository()
    		{	
    		try {	RandomAccessFile raf= new RandomAccessFile ("Result_221.1.dat", "r");
    			boolean fin=false;
    			int i=0;
    			raf.seek(50);
    			byte [] tab = new byte[2454];
    			int n=raf.read(tab);
    			System.out.println("buffer length "+n);
    				//bb[0]=b;
    				//System.out.print(new String (bb));
    				//i++;
     
    				//byte [] buffer=new byte[9407];
    			        //int n= raf8.read(buffer);
    			        //System.out.println("GZIP Buffer of length "+n);
    				//byte tab[]= new byte [9407 -964];
    			        //System.arraycopy(buffer,964, tab,0,(9407-964));
    			        //System.arraycopy(bb,0, buffer,51,(10000-35));	
    			return tab;	}
    		catch (Exception e)
    		{
    			e.printStackTrace();
    		}
    		return null;
    	}
     
     
     
    public static byte[] getESGDataRepository()
    	{
    	byte[] tab= new byte [50];
     
    //00 00 13 00 23 10 f0 39 0 0 c3 c0 84 04 34 34 1c 1c 68 5c 87 83 00 84 13 00 23 10 f0 39 00 01 43 c0 84 04 34 34 1c 1c 5
     
     
     
     
    	tab[0]=(byte)0x00;
    	tab[1]=(byte)0x00;
    	tab[2]=(byte)0x13;
    	tab[3]=(byte)0x00;
    	tab[4]=(byte)0x23;
    	tab[5]=(byte)0x10;
    	tab[6]=(byte)0xF0;
    	tab[7]=(byte)0x39;
    	tab[8]=(byte)0x00;
    	tab[9]=(byte)0x00;
     
    	tab[10]=(byte)0xC3;
    	tab[11]=(byte)0xC0;
    	tab[12]=(byte)0x84;
    	tab[13]=(byte)0x04;
    	tab[14]=(byte)0x34;
    	tab[15]=(byte)0x34;
    	tab[16]=(byte)0x1C;
    	tab[17]=(byte)0x1C;
    	tab[18]=(byte)0x68;
    	tab[19]=(byte)0x5C;
    	tab[20]=(byte)0x87;
     
    	tab[21]=(byte)0x83;
    	tab[22]=(byte)0x00;
    	tab[23]=(byte)0x84;
    	tab[24]=(byte)0x13;
    	tab[25]=(byte)0x00;
    	tab[26]=(byte)0x23;
    	tab[27]=(byte)0x10;
    	tab[28]=(byte)0xF0;
    	tab[29]=(byte)0x39;
     
    	tab[30]=(byte)0x00;
    	tab[31]=(byte)0x01;
    	tab[32]=(byte)0x43;
    	tab[33]=(byte)0xC0;
    	tab[34]=(byte)0x84;
    	tab[35]=(byte)0x04;
    	tab[36]=(byte)0x34;
    	tab[37]=(byte)0x34;
    	tab[38]=(byte)0x1C;
    	tab[39]=(byte)0x1C;
     
    //c 87 83 01 08 13 00 23 10 f0 39 00 00 43 c0 84 04 34 34 1c 1c 68 5c 87 83 01 8a 05 00 25 10 02 1f 04 8e 05 00 25 10 
     
    //02 1f 07 12 05 00 25 10 02 1f
     
    	tab[40]=(byte)0x05;
    	tab[41]=(byte)0x0C;
    	tab[42]=(byte)0x87;
    	tab[43]=(byte)0x83;
    	tab[44]=(byte)0x01;
    	tab[45]=(byte)0x08;
    	tab[46]=(byte)0x13;
    	tab[47]=(byte)0x00;
    	tab[48]=(byte)0x23;
    	tab[49]=(byte)0x10;
    	tab[50]=(byte)0xF0;
    	tab[51]=(byte)0x39;
     
    	tab[52]=(byte)0x00;
    	tab[53]=(byte)0x00;
    	tab[54]=(byte)0x43;
    	tab[55]=(byte)0xC0;
    	tab[56]=(byte)0x84;
    	tab[57]=(byte)0x04;
    	tab[58]=(byte)0x34;
    	tab[59]=(byte)0x34;
    	tab[60]=(byte)0x1C;
     
    	tab[61]=(byte)0x1C;
    	tab[62]=(byte)0x68;
    	tab[63]=(byte)0x5C;
    	tab[64]=(byte)0x87;
    	tab[65]=(byte)0x83;
    	tab[66]=(byte)0x01;
    	tab[67]=(byte)0x8A;
    	tab[68]=(byte)0x05;
    	tab[69]=(byte)0x00;
    	tab[70]=(byte)0x25;
    	tab[71]=(byte)0x10;
     
    	tab[72]=(byte)0x02;
    	tab[73]=(byte)0x1F;
    	tab[74]=(byte)0x04;
    	tab[75]=(byte)0x8E;
    	tab[76]=(byte)0x05;
    	tab[77]=(byte)0x00;
    	tab[78]=(byte)0x25;
    	tab[79]=(byte)0x10;
    	tab[80]=(byte)0x02;
     
    	tab[81]=(byte)0x1F;
    	tab[82]=(byte)0x07;
    	tab[83]=(byte)0x12;
    	tab[84]=(byte)0x05;
    	tab[85]=(byte)0x00;
    	tab[86]=(byte)0x25;
    	tab[87]=(byte)0x10;
    	tab[88]=(byte)0x02;
    	tab[89]=(byte)0x1F;
     
    	tab[90]=(byte)0x1F;
     
     
    	return tab;
     
    }
     
      public byte[] concat(byte[] tab1, byte[] tab2, byte[] tab3){
            byte[] tabResult = new Object[tab1.length + tab2.length + tab3.length];
            int count = 0;
            for(int i=0; i<tab1.length; i++)
                tabResult[count++] = tab1[i];
            for(int i=0; i<tab2.length; i++)
                tabResult[count++] = tab2[i];
    	for(int i=0; i<tab3.length; i++)
                tabResult[count++] = tab3[i];
            return tabResult;
        }
     
    	byte[] result = concat(tab, getFragmentManagement(), getDataRepository());
     
    };
    tout en sachant ke j ai essayé de rassembles les contenus des trois tableaux dans un seul tableau global et ke j ne sais tjrs pas si j k j ai codé est juste et cohérent..merci pour votre aide a tous..

  6. #6
    Membre Expert
    Avatar de CheryBen
    Inscrit en
    Mai 2005
    Messages
    1 599
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 599
    Par défaut
    Ta fonction concat me parait correcte.

    Pour écrire ça dans un fichier, utilise un FileOutputStream, il y a une méthode write(byte[] b)

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    80
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 80
    Par défaut
    Citation Envoyé par morph41 Voir le message
    Ta fonction concat me parait correcte.

    Pour écrire ça dans un fichier, utilise un FileOutputStream, il y a une méthode write(byte[] b)

    merci morph..

    j vais essayer ca

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Mail] probleme avec fonction mail() !!!
    Par H-bil dans le forum Langage
    Réponses: 6
    Dernier message: 19/06/2006, 23h45
  2. C++ - Probleme avec fonction virtuelle
    Par vdumont dans le forum C++
    Réponses: 1
    Dernier message: 20/03/2006, 20h49
  3. probleme avec fonctions
    Par Burinho dans le forum C
    Réponses: 8
    Dernier message: 29/12/2005, 21h28
  4. Réponses: 17
    Dernier message: 24/03/2005, 12h24
  5. [langage] problème avec fonction read
    Par domidum54 dans le forum Langage
    Réponses: 2
    Dernier message: 30/03/2004, 20h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo