@Test public void readBooleanReadsCorrectAmountOfBytes() { AtomicInteger bytesTriedToRead = new AtomicInteger(0); rawReader = (process, offset, bytesToRead) -> { bytesTriedToRead.addAndGet(bytesToRead); return ByteBuffer.allocate(bytesToRead); }; reader.readBoolean(process, 0); assertEquals(BOOLEAN_SIZE, bytesTriedToRead.get()); }
@Override public boolean readBoolean(NativeProcess process, int offset) { byte readByte = rawMemoryReader.read(process, offset, TypeSize.BOOLEAN.getSize()).get(); return readByte != 0; }
MemoryReaderImpl implements MemoryReader { @Override public boolean readBoolean(NativeProcess process, int offset) { byte readByte = rawMemoryReader.read(process, offset, TypeSize.BOOLEAN.getSize()).get(); return readByte != 0; } }
MemoryReaderImpl implements MemoryReader { @Override public boolean readBoolean(NativeProcess process, int offset) { byte readByte = rawMemoryReader.read(process, offset, TypeSize.BOOLEAN.getSize()).get(); return readByte != 0; } MemoryReaderImpl(RawMemoryReader rawMemoryReader); }
MemoryReaderImpl implements MemoryReader { @Override public boolean readBoolean(NativeProcess process, int offset) { byte readByte = rawMemoryReader.read(process, offset, TypeSize.BOOLEAN.getSize()).get(); return readByte != 0; } 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 boolean readBoolean(NativeProcess process, int offset) { byte readByte = rawMemoryReader.read(process, offset, TypeSize.BOOLEAN.getSize()).get(); return readByte != 0; } 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);  }