Here you can find the source of writeSize(final int s, ByteBuffer buffer)
public final static void writeSize(final int s, ByteBuffer buffer)
//package com.java2s; /**//from w w w .j ava2s. c o m * Copyright - See the COPYRIGHT that is included with this distribution. * EPICS pvData is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ import java.nio.ByteBuffer; public class Main { public final static void writeSize(final int s, ByteBuffer buffer) { if (s == -1) // null buffer.put((byte) -1); else if (s < 254) buffer.put((byte) s); else buffer.put((byte) -2).putInt(s); // (byte)-2 + size } }