简体   繁体   English

将代码点附加到 java.lang.Appendable

[英]Appending a codepoint to a java.lang.Appendable

java.lang.Appendable supports append(char) but not appendCodepoint(int) . java.lang.Appendable支持append(char)但不支持appendCodepoint(int)

Is there any efficient way (no object creation) using the standard libraries to append a codepoint to an Appendable that works with supplemental codepoints?是否有任何有效的方法(不创建对象)使用标准库将代码点附加到可与补充代码点一起使用的Appendable

I'd rather not roll my own UTF-16 encode function, and everything in java.lang.Character requires mucking around with char[] s.我宁愿不推出自己的 UTF-16 编码函数,而且java.lang.Character所有内容都需要使用char[] s。

I mean, it sounds like what you want is just to do Character.toChars(int) without the array overhead, right?我的意思是,听起来您想要的只是在没有数组开销的情况下执行Character.toChars(int) ,对吗? Here's the source of Character.toChars ;这是Character.toChars的来源; it's not particularly complicated to replicate yourself.复制自己并不是特别复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM