code: public static int getNameBytes(StringBuffer name, byte[] buf, int offset, int length) {
          int i;
  
          for (i = 0; i < length && i < name.length(); ++i) {
              buf[offset + i] = (byte) name.charAt(i);
          }
  
          for (; i < length; ++i) {
              buf[offset + i] = 0;
          }
  
          return offset + length;
      }
docs: Move the bytes from the name StringBuffer into the header's buffer.
  
  @param header
  The header buffer into which to copy the name.
  @param offset
  The offset into the buffer at which to store.
  @param length
  The number of header bytes to store.
  @return The new offset (offset + length).