Here you can find the source of fillDdsBuffer(ByteBuffer buf)
public static ByteBuffer fillDdsBuffer(ByteBuffer buf)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static final float ddsPrecision = 0.95f; public static final String ddsDescription = "Answer"; public static final boolean ddsAcknowledged = false; public static final int ddsNumber = 42; public static ByteBuffer fillDdsBuffer(ByteBuffer buf) { // Actually, format of SUPPORTED_CLASS topic is: // an int (number) // a boolean (acknowledeged) // a String (description) // a float (precision) // rewind the buffer buf.rewind();/*from w w w. j av a2 s . c o m*/ // put a number buf.putInt(ddsNumber); buf.put((byte) (ddsAcknowledged ? 1 : 0)); buf.putInt(ddsDescription.length()); for (int i = 0; i < ddsDescription.length(); i++) { buf.putChar(ddsDescription.charAt(i)); } buf.putFloat(ddsPrecision); buf.rewind(); //Don't forget to rewind the buffer. The interface processor won't do it... return buf; } }