Code example for ByteBuffer

Methods: get, limit

0
    int eventSrcId = event.getSourceId();
 
    if (event.isCheckpointMessage())
    { 
      ByteBuffer eventValue = event.value();
      byte[] eventBytes = new byte[eventValue.limit()];
      eventValue.get(eventBytes);
 
      if (eventValue.limit() > 0)
      { 
        try 
        { 
          String cpString = new String(eventBytes, "UTF-8");
          ckptInEvent = new Checkpoint(cpString);
          _lastCkpt = ckptInEvent;
          getLog().info("bootstrap checkpoint received: " + ckptInEvent);
 
          _bootstrapMode = _lastCkpt.getConsumptionMode();
 
          curState.setEventsSeen(true);