// Зная длину формируем массив байт, в котором и содержится эта длина private byte[] constructLength(uint len) { byte[] res = new byte[1]; if (len < 126) { res[0] = (byte)len; } else if (len < 65536) { res = ByteManager.bytesFromInt16((ushort)len); } else { res = ByteManager.bytesFromInt64((ulong)len); } return(res); }