Example #1
0
 /**
  * @param data Guaranteed to be non null
  * @param offset
  * @param length
  */
 public void send(byte[] data, int offset, int length) throws Exception {
   if (sender != null) {
     byte[] copy = new byte[length];
     System.arraycopy(data, offset, copy, 0, length);
     sender.addToQueue(new Buffer(copy, 0, length));
   } else _send(data, offset, length, true, true);
 }
Example #2
0
 /**
  * @param data Guaranteed to be non null
  * @param offset
  * @param length
  */
 private void send(byte[] data, int offset, int length) throws Exception {
   if (isSenderUsed()) {
     // we need to copy the byte[] buffer here because the original buffer might get
     // changed meanwhile
     byte[] tmp = new byte[length];
     System.arraycopy(data, offset, tmp, 0, length);
     sender.addToQueue(tmp);
   } else {
     _send(data, offset, length, true);
   }
 }