Esempio n. 1
0
 public void actualSend(int tag, int flags, byte[] bytes, SendCallback cb) {
   if (s == null) {
     throw new IllegalStateException("No endpoint set");
   }
   boolean fin = (flags & FINAL_FLAG) != 0;
   boolean error = (flags & ERROR_FLAG) != 0;
   boolean reply = (flags & REPLY_FLAG) != 0;
   // must make a copy of the buffer since system assumes that
   // buffer is reusable after being sent
   byte[] copy = new byte[bytes.length];
   System.arraycopy(bytes, 0, copy, 0, bytes.length);
   if (reply) {
     s.handleReply(tag, flags, copy.length, copy);
   } else {
     s.handleRequest(tag, flags, copy.length, copy);
   }
   if (cb != null) {
     cb.dataSent();
   }
 }
Esempio n. 2
0
 @OnClick(R.id.send)
 void onSendInvoked() {
   if (sendCallback != null) {
     sendCallback.onSend(getText());
   }
 }