@Test public void writeCharWritesNormalAsciiRangeStuffCorrectly() { String source = "liirum Laarum TOASTER quick$ort w0t 5619234 + 4123 - f23 * 14 / ,.-^[] byte[] expected = source.getBytes(StandardCharsets.UTF_8); for (int i = 0; i < source.length(); i++) { writer.writeCharUTF8(process, i, source.charAt(i)); } assertArrayEquals(expected, rawByteWriter.getBytes()); }
@Override public void writeCharUTF8(NativeProcess process, int offset, char value) throws MemoryAccessException { ByteBuffer buffer = createLEBuffer(TypeSize.CHAR_UTF8.getSize()); byte[] bytes = Character.toString(value).getBytes(StandardCharsets.UTF_8); buffer.put(bytes[0]); writer.write(process, offset, buffer.array()); }
MemoryWriterImpl implements MemoryWriter { @Override public void writeCharUTF8(NativeProcess process, int offset, char value) throws MemoryAccessException { ByteBuffer buffer = createLEBuffer(TypeSize.CHAR_UTF8.getSize()); byte[] bytes = Character.toString(value).getBytes(StandardCharsets.UTF_8); buffer.put(bytes[0]); writer.write(process, offset, buffer.array()); } }
MemoryWriterImpl implements MemoryWriter { @Override public void writeCharUTF8(NativeProcess process, int offset, char value) throws MemoryAccessException { ByteBuffer buffer = createLEBuffer(TypeSize.CHAR_UTF8.getSize()); byte[] bytes = Character.toString(value).getBytes(StandardCharsets.UTF_8); buffer.put(bytes[0]); writer.write(process, offset, buffer.array()); } MemoryWriterImpl(RawMemoryWriter writer); }
MemoryWriterImpl implements MemoryWriter { @Override public void writeCharUTF8(NativeProcess process, int offset, char value) throws MemoryAccessException { ByteBuffer buffer = createLEBuffer(TypeSize.CHAR_UTF8.getSize()); byte[] bytes = Character.toString(value).getBytes(StandardCharsets.UTF_8); buffer.put(bytes[0]); writer.write(process, offset, buffer.array()); } MemoryWriterImpl(RawMemoryWriter writer); @Override void writeBoolean(NativeProcess process, int offset, boolean value); @Override void writeByte(NativeProcess process, int offset, byte value); @Override void writeCharUTF8(NativeProcess process, int offset, char value); @Override void writeCharUTF16LE(NativeProcess process, int offset, char value); @Override void writeShort(NativeProcess process, int offset, short value); @Override void writeInt(NativeProcess process, int offset, int value); @Override void writeFloat(NativeProcess process, int offset, float value); @Override void writeLong(NativeProcess process, int offset, long value); @Override void writeDouble(NativeProcess process, int offset, double value); @Override void writeStringUTF8(NativeProcess process, int offset, String value); @Override void writeStringUTF16LE(NativeProcess process, int offset, String value); @Override void write(NativeProcess process, int offset, byte[] values); }
MemoryWriterImpl implements MemoryWriter { @Override public void writeCharUTF8(NativeProcess process, int offset, char value) throws MemoryAccessException { ByteBuffer buffer = createLEBuffer(TypeSize.CHAR_UTF8.getSize()); byte[] bytes = Character.toString(value).getBytes(StandardCharsets.UTF_8); buffer.put(bytes[0]); writer.write(process, offset, buffer.array()); } MemoryWriterImpl(RawMemoryWriter writer); @Override void writeBoolean(NativeProcess process, int offset, boolean value); @Override void writeByte(NativeProcess process, int offset, byte value); @Override void writeCharUTF8(NativeProcess process, int offset, char value); @Override void writeCharUTF16LE(NativeProcess process, int offset, char value); @Override void writeShort(NativeProcess process, int offset, short value); @Override void writeInt(NativeProcess process, int offset, int value); @Override void writeFloat(NativeProcess process, int offset, float value); @Override void writeLong(NativeProcess process, int offset, long value); @Override void writeDouble(NativeProcess process, int offset, double value); @Override void writeStringUTF8(NativeProcess process, int offset, String value); @Override void writeStringUTF16LE(NativeProcess process, int offset, String value); @Override void write(NativeProcess process, int offset, byte[] values);  }