@Test public void readCharUTF16LEReadsCharAtOffset() { String text = "Quads"; int expectedOffset = 0xBEEF; rawReader = (process, offset, bytesToRead) -> { assertEquals(expectedOffset, offset); ByteBuffer ret = toBuffer(text.getBytes(StandardCharsets.UTF_16LE)); ret.order(ByteOrder.LITTLE_ENDIAN); ret.limit(bytesToRead); return ret; }; char result = reader.readCharUTF16LE(process, 0xBEEF); assertEquals(text.charAt(0), result); }
@Override public char readCharUTF16LE(NativeProcess process, int offset) { return rawMemoryReader.read(process, offset, TypeSize.CHAR_UTF16LE.getSize()).getChar(); }
MemoryReaderImpl implements MemoryReader { @Override public char readCharUTF16LE(NativeProcess process, int offset) { return rawMemoryReader.read(process, offset, TypeSize.CHAR_UTF16LE.getSize()).getChar(); } }
MemoryReaderImpl implements MemoryReader { @Override public char readCharUTF16LE(NativeProcess process, int offset) { return rawMemoryReader.read(process, offset, TypeSize.CHAR_UTF16LE.getSize()).getChar(); } MemoryReaderImpl(RawMemoryReader rawMemoryReader); }
MemoryReaderImpl implements MemoryReader { @Override public char readCharUTF16LE(NativeProcess process, int offset) { return rawMemoryReader.read(process, offset, TypeSize.CHAR_UTF16LE.getSize()).getChar(); } MemoryReaderImpl(RawMemoryReader rawMemoryReader); @Override boolean readBoolean(NativeProcess process, int offset); @Override byte readByte(NativeProcess process, int offset); @Override char readCharUTF8(NativeProcess process, int offset); @Override char readCharUTF16LE(NativeProcess process, int offset); @Override short readShort(NativeProcess process, int offset); @Override int readInt(NativeProcess process, int offset); @Override float readFloat(NativeProcess process, int offset); @Override long readLong(NativeProcess process, int offset); @Override double readDouble(NativeProcess process, int offset); @Override String readStringUTF8(NativeProcess process, int offset, int maxCodeUnitsToRead); @Override String readStringUTF16LE(NativeProcess process, int offset, int maxCodeUnitsToRead); @Override byte[] read(NativeProcess process, int offset, int bytesToRead); }
MemoryReaderImpl implements MemoryReader { @Override public char readCharUTF16LE(NativeProcess process, int offset) { return rawMemoryReader.read(process, offset, TypeSize.CHAR_UTF16LE.getSize()).getChar(); } MemoryReaderImpl(RawMemoryReader rawMemoryReader); @Override boolean readBoolean(NativeProcess process, int offset); @Override byte readByte(NativeProcess process, int offset); @Override char readCharUTF8(NativeProcess process, int offset); @Override char readCharUTF16LE(NativeProcess process, int offset); @Override short readShort(NativeProcess process, int offset); @Override int readInt(NativeProcess process, int offset); @Override float readFloat(NativeProcess process, int offset); @Override long readLong(NativeProcess process, int offset); @Override double readDouble(NativeProcess process, int offset); @Override String readStringUTF8(NativeProcess process, int offset, int maxCodeUnitsToRead); @Override String readStringUTF16LE(NativeProcess process, int offset, int maxCodeUnitsToRead); @Override byte[] read(NativeProcess process, int offset, int bytesToRead);  }