Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

xp

By: a guest on Nov 11th, 2009  |  syntax: Java  |  size: 1.04 KB  |  views: 139  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. InputStreamReader reader = new InputStreamReader(conn.openInputStream());
  2.             int BUFFER = 112;
  3.             char[] buffer = new char[BUFFER];
  4.        
  5.             while (reader.read(buffer) == BUFFER) {
  6.                 int iniTrama = (buffer[1] << 8) | buffer[0];
  7.                 int finTrama = (buffer[BUFFER - 1] << 8) | buffer[BUFFER - 2];
  8.                 if (iniTrama == 43690 && finTrama == 5000) { // Validation
  9.                     for (int i = 2; i < BUFFER - 2; i = i + 2) {
  10.                         int word = (buffer[i + 1] << 8) | buffer[i];
  11.                         int valorEcg = word;
  12.                         if (indexSignal == SIGNAL_SIZE) { // a temporal memory
  13.                             signal = new int[SIGNAL_SIZE];
  14.                             indexSignal = 0;
  15.                         }
  16.                         signal[indexSignal++] = valorEcg; // The value
  17.                         repaint(); // Call Canvas
  18.                     }
  19.                 } else {
  20.                     ....
  21.                 }
  22.             }