/**
  * 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) {
   if (num >= 1 && buffer.remaining() >= 2) {
     myItem.set(buffer.getShort() & 0xFFFF);
     return 1;
   } else {
     return 0;
   }
 }
 /**
  * Send as many items as possible from this buffer to the given byte buffer.
  *
  * <p>The <TT>sendItems()</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 send, in the range 0 .. <TT>length</TT>-1.
  * @param buffer Byte buffer.
  * @return Number of items sent.
  */
 protected int sendItems(int i, ByteBuffer buffer) {
   if (buffer.remaining() >= 2) {
     buffer.putShort((short) myItem.get());
     return 1;
   } else {
     return 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, int item) {
   myItem.set(item);
 }
 /**
  * Obtain the given item from this buffer.
  *
  * <p>The <TT>get()</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.
  * @return Item at index <TT>i</TT>.
  */
 public int get(int i) {
   return myItem.get();
 }