Esempio n. 1
0
 /**
  * Receive as many items as possible from the given byte buffer to this buffer.
  *
  * <p>The <TT>receiveItems()</TT> method must not block the calling thread; if it does, all
  * message I/O in MP will be blocked.
  *
  * @param i Index of first item to receive, in the range 0 .. <TT>length</TT>-1.
  * @param num Maximum number of items to receive.
  * @param buffer Byte buffer.
  * @return Number of items received.
  */
 protected int receiveItems(int i, int num, ByteBuffer buffer) {
   int index = i;
   int off = myArrayOffset + i * myStride;
   int max = Math.min(i + num, myLength);
   while (index < max && buffer.remaining() >= 8) {
     myArray.set(off, buffer.getLong());
     ++index;
     off += myStride;
   }
   return index - i;
 }
Esempio n. 2
0
 /**
  * Store the given item in this buffer.
  *
  * <p>The <TT>put()</TT> method must not block the calling thread; if it does, all message I/O in
  * MP will be blocked.
  *
  * @param i Item index in the range 0 .. <TT>length()</TT>-1.
  * @param item Item to be stored at index <TT>i</TT>.
  */
 public void put(int i, long item) {
   myArray.set(myArrayOffset + i * myStride, item);
 }