comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 210:af235340fcde

use array copy rather than loops
author Carl Byington <carl@five-ten-sg.com>
date Mon, 07 Jul 2014 09:57:13 -0700
parents f86f1e37b504
children 7e4352b53f24
comparison
equal deleted inserted replaced
209:53f66625d618 210:af235340fcde
398 } 398 }
399 399
400 public synchronized void setField(int l, int c, char[] data, int offset) { 400 public synchronized void setField(int l, int c, char[] data, int offset) {
401 Log.i(TAG, "setField()"); 401 Log.i(TAG, "setField()");
402 char[] da = new char[data.length - offset]; 402 char[] da = new char[data.length - offset];
403 int i; 403 System.arraycopy(data, offset, da, 0, data.length-offset);
404
405 for (i = 0; i < da.length; i++) {
406 da[i] = data[i + offset];
407 }
408
409 buffer.setField(l, c, da); 404 buffer.setField(l, c, da);
410 } 405 }
411 406
412 public synchronized void showUrl(char [] data, int offset) { 407 public synchronized void showUrl(char [] data, int offset) {
413 Log.i(TAG, "setField()"); 408 Log.i(TAG, "setField()");
414 char[] da = new char[data.length - offset]; 409 char[] da = new char[data.length - offset];
415 int i; 410 System.arraycopy(data, offset, da, 0, data.length-offset);
416
417 for (i = 0; i < da.length; i++) {
418 da[i] = data[i + offset];
419 }
420 String url = new String(da); 411 String url = new String(da);
421 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); 412 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
422 parent.startActivity(intent); 413 parent.startActivity(intent);
423 } 414 }
424 415