encodeLenBytes static method
Implementation
static int encodeLenBytes(len) {
if (len <= 0x7f) {
return 1;
} else if (len <= 0xff) {
return 2;
} else if (len <= 0xffff) {
return 3;
} else if (len <= 0xffffff) {
return 4;
} else {
throw Exception("Length too long (> 4 bytes)");
}
}