code: public ByteBuffer createMessage(boolean compress, int version)
      {
          int header = 0;
          // set compression bit.
          if (compress)
              header |= 4;
          // set streaming bit
          header |= 8;
          // Setting up the version bit
          header |= (version << 8);
  
          byte[] bytes;
          try
          {
              int size = (int)StreamInitMessage.serializer.serializedSize(this, version);
              DataOutputBuffer buffer = new DataOutputBuffer(size);
              StreamInitMessage.serializer.serialize(this, buffer, version);
              bytes = buffer.getData();
          }
          catch (IOException e)
          {
              throw new RuntimeException(e);
          }
          assert bytes.length > 0;
  
          ByteBuffer buffer = ByteBuffer.allocate(4 + 4 + bytes.length);
          buffer.putInt(MessagingService.PROTOCOL_MAGIC);
          buffer.putInt(header);
          buffer.put(bytes);
          buffer.flip();
          return buffer;
      }
docs: Create serialized message.
  
  @param compress true if message is compressed
  @param version Streaming protocol version
  @return serialized message in ByteBuffer format