private static byte trailingOctet(int codepoint, int leftToWrite) {
        return (byte) (0x80 | ((codepoint >> (6 * leftToWrite)) & 0x3F));
    }
Encode a valid Unicode codepoint as a sequence of UTF-8 bytes into an
OutputStream.

@param codepoint
           Unicode codepoint to encode
@param destination
           buffer to write into
@return number of bytes written
@throws IOException
            propagated from stream
vespajlib/src/main/java/com/yahoo/text/Utf8.java