protected void generateBytesExc() {
		bb.flip();
		try {
			if (bb.hasRemaining()) {
				generateBytes(bb);
			}
		}
		catch (Throwable t) {
			Msg.error(this, "Error generating bytes: " + t, t);
		}
		finally {
			bb.clear();
		}
	}
If I ever care to support Unicode, I may need to worry about surrogate pairs.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalAwtEventEncoder.java