public void print(char[] s) {
print(s, 0, s.length);
}
private void print(char[] s, int begin, int end) {
CharBuffer src = new CharBuffer(s, begin, end);
byte[] destBytes = new byte[TMath.max(16, TMath.min(s.length, 1024))];
ByteBuffer dest = new ByteBuffer(destBytes);
while (!src.end()) {
charset.encode(src, dest);
write(destBytes, 0, dest.position());
dest.rewind(0);
}
}