output.writeByte((byte) (FrameBits.LENGTH_2_BYTE_CODE | maskFlag));
output.writeByte((byte) ((length >> 8) & 0xFF));
output.writeByte((byte) (length & 0xFF));
} else {
output.writeByte((byte) (FrameBits.LENGTH_8_BYTE_CODE | maskFlag));
output.writeByte((byte) 0);
output.writeByte((byte) 0);
output.writeByte((byte) 0);
output.writeByte((byte) 0);
output.writeByte((byte) (length >>> 24));
output.writeByte((byte) ((length >> 16) & 0xFF));