Ejemplo n.º 1
0
 private void processHeader(InputStream fileinputstream) throws X10FlashException {
   try {
     byte abyte0[] = new byte[6];
     int j = fileinputstream.read(abyte0);
     if (j != 6) {
       fileinputstream.close();
       throw new X10FlashException("Error in processHeader");
     }
     int k;
     byte abyte1[] = new byte[4];
     System.arraycopy(abyte0, 2, abyte1, 0, 4);
     k = BytesUtil.getInt(abyte1);
     abyte1 = new byte[k - 6];
     k = fileinputstream.read(abyte1);
     if (k != abyte1.length) {
       fileinputstream.close();
       throw new X10FlashException("Error in processHeader");
     }
     cmd.send(Command.CMD05, BytesUtil.concatAll(abyte0, abyte1), false);
     if (USBFlash.getLastFlags() == 0) getLastError();
   } catch (IOException ioe) {
     throw new X10FlashException("Error in processHeader : " + ioe.getMessage());
   }
 }