# Class: com.pnfsoftware.jeb.core.units.code.asm.memory.VirtualMemoryUtil

Utility methods for [virtual memory](IVirtualMemory) classes. 

 \- Methods of this class do not raise [MemoryException](MemoryException). Instead, they return a boolean value to notify success or failure of the operation.
 \- Unless otherwise specified, memory protection is **disregarded** when reading and writing using those methods.

## Static Method: allocate
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `start`, type: `long`
- parameter: `size`, type: `int`
- parameter: `protection`, type: `int`
- return type: `long`

Description: Search an available range and allocate at least the requested amount of bytes. Do not confuse this method with [IVirtualMemory#allocate(long, int, int)](IVirtualMemory#allocate(long, int, int)).
parameter: mem: virtual memory
parameter: start: soft start address, considered a hint by this allocator routine; if you wish to            allocate at a fixed, given address, use            [IVirtualMemory#allocate(long, int, int)](IVirtualMemory#allocate(long, int, int))
parameter: size: range size
parameter: protection: protection flags
return: the base address of the allocated memory range; \-1 on error

## Static Method: allocateFillGaps
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- parameter: `protection`, type: `int`
- return type: `int`

Description: Allocate a memory range, filling gaps in between already allocated pages if needed. \(The given range \[address, address \+ size\) may have already allocated pages. Those pages will not be re\-allocated.\) When the method returns, the range \[address, address \+ size\) is guaranteed to be allocated.
parameter: mem: virtual memory
parameter: address: start address
parameter: size: range size
parameter: protection: protection flags
return: the number of pages that were actually allocated

## Static Method: canRead
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `addr`, type: `long`
- parameter: `size`, type: `int`
- return type: `boolean`

Description: Check whether a range is readable.
parameter: mem: virtual memory
parameter: addr: start address
parameter: size: range size
return: true if the range is readable

## Static Method: canWrite
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `addr`, type: `long`
- parameter: `size`, type: `int`
- return type: `boolean`

Description: Check whether a range is writable.
parameter: mem: virtual memory
parameter: addr: start address
parameter: size: range size
return: true if the range is writable

## Static Method: checkPermissions
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `addr`, type: `long`
- parameter: `size`, type: `int`
- parameter: `wantedPermissions`, type: `int`
- return type: `boolean`

Description: Check whether a range has the requested permissions.
parameter: mem: virtual memory
parameter: addr: start address
parameter: size: range size
parameter: wantedPermissions: requested permissions
return: true if all pages have the requested permissions

## Static Method: convertSegmentFlagsToVMFlags
- parameter: `segmentFlags`, type: `int`
- return type: `int`

Description: Convert segment permissions to virtual memory access flags.
parameter: segmentFlags: [ISegmentInformation](ISegmentInformation) \(FLAG\_xxx\) flags
return: a combination of [IVirtualMemory](IVirtualMemory) \(ACCESS\_xxx\) flags

## Static Method: createMemory
- parameter: `spaceBits`, type: `int`
- parameter: `pageBits`, type: `int`
- parameter: `standardEndianness`, type: `com.pnfsoftware.jeb.util.io.Endianness`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`

Description: Facade factory method returning a concrete, private implementation of an efficient page\-based virtual memory.
parameter: spaceBits: address space bit size
parameter: pageBits: page bit size
parameter: standardEndianness: standard endianness
return: virtual memory

## Static Method: deallocate
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `addr`, type: `long`
- parameter: `size`, type: `int`
- return type: `boolean`

Description: Free a range previously allocated with [allocate](#allocate(IVirtualMemory, long, int, int)).
parameter: mem: virtual memory
parameter: addr: range start address
parameter: size: range size
return: success indicator

## Static Method: dump
- parameter: `vm`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `addr`, type: `long`
- parameter: `addrEnd`, type: `long`
- return type: `byte[]`

Description: Dump a contiguous memory range of memory to a byte array. Illegal pages \(non\-allocated\) are dumped as empty pages \(all bytes are zero\). Memory protection is disregarded.
parameter: vm: virtual memory
parameter: addr: start address
parameter: addrEnd: end address
return: the byte buffer holding the dumped data

## Static Method: dump
- parameter: `vm`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `addr`, type: `long`
- parameter: `addrEnd`, type: `long`
- parameter: `dst`, type: `byte[]`
- parameter: `dstOffset`, type: `int`

Description: Dump a contiguous memory range of memory to a buffer. Illegal pages \(non\-allocated\) are dumped as empty pages \(all bytes are zero\). Memory protection is disregarded.
parameter: vm: virtual memory
parameter: addr: start address
parameter: addrEnd: end address
parameter: dst: destination buffer
parameter: dstOffset: offset in the destination

## Static Method: dumpToImageFiles
- parameter: `vm`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `folder`, type: `java.io.File`

Description: Dump a virtual memory to files in a folder. The files will be named as the start of the memory range \(in hex\) they contain. Memory protection is disregarded.
parameter: vm: virtual memory
parameter: folder: destination folder; if it does not exist, a new folder will be created
throws: if dumping fails

## Static Method: dumpToImageFiles
- parameter: `vm`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `folder`, type: `java.io.File`
- parameter: `pfx`, type: `java.lang.String`
- parameter: `sfx`, type: `java.lang.String`

Description: Dump a virtual memory to files in a folder. The files will be named `[PREFIX][MEMORY_RANGE_START][SUFFIX]`. Memory protection is disregarded.
parameter: vm: virtual memory
parameter: folder: destination folder; if it does not exist, a new folder will be created
parameter: pfx: optional prefix for the filenames
parameter: sfx: optional suffix for the filenames
throws: if dumping fails

## Static Method: findAvailableRange
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `start`, type: `long`
- parameter: `size`, type: `int`
- return type: `long`

Description: Search for an available memory range.
parameter: mem: virtual memory
parameter: start: soft start address, a hint
parameter: size: range size
return: the range start address, \-1 on error

## Static Method: findByte
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `lastAddress`, type: `long`
- parameter: `val`, type: `int`
- return type: `long`

Description: Search for a single byte of memory. Similar as `memchr` or `memrchr` \(if `lastAddress` is less than `address`\).
parameter: mem: virtual memory
parameter: address: start address
parameter: lastAddress: last address
parameter: val: byte value
return: matching address, or \-1

## Static Method: findBytes
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `bypassProtection`, type: `boolean`
- parameter: `address`, type: `long`
- parameter: `lastAddress`, type: `long`
- parameter: `pattern`, type: `byte[]`
- parameter: `patternMask`, type: `byte[]`
- return type: `long`

Description: Search for bytes in memory, with an optional binary mask. The search can either be forward \(default\), in which case the resulting found address will be either \-1 or ≥ the start address, or backward, in which case the resulting found address will be either \-1 or ≤ the start address.
parameter: mem: memory to be searched
parameter: bypassProtection: if true, memory page protection is disregarded, in which case all            pages, including non\-readable ones, will be searched
parameter: address: start address for the search \(this value is treated as unsigned\)
parameter: lastAddress: end address \(the value is treated as unsigned\); may be less than the start            address, in which case a reverse search will be performed
parameter: pattern: bytes to search for; the maximum allowed length is the memory's page size
parameter: patternMask: optional binary mask for a wildcard search; if non\-null, must be the same            length as the pattern's
return: \-1 if not found, else, the resulting address

## Static Method: getCopyOnWriteShim
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemoryShim`

Description: Create a copy\-on\-write shim of the provided virtual memory, if possible. The shim can be used to perform safe memory writes, that will not impact the underlying memory. Using a shim yields better performance than copying the entire source VM and working on the full copy.
parameter: mem: a VM
return: the shim VM
throws: if the provided VM object does not support the creation of a             shim

## Static Method: isPageAllocated
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- return type: `boolean`

Description: Verify if a page was allocated \(regardless of protection rights on the page\).
parameter: mem: virtual memory
parameter: address: address within the page
return: true if the page is allocated

## Static Method: readAsBigIntegerSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- return type: `java.math.BigInteger`

Description: Read an Big Integer \(16\-bytes\). Standard memory byte ordering is used for decoding. Memory protection is disregarded.
parameter: mem: the virtual memory
parameter: address: memory address of the data
return: the Big Integer or null on error

## Static Method: readAsBigIntegerSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `endianness`, type: `com.pnfsoftware.jeb.util.io.Endianness`
- parameter: `address`, type: `long`
- return type: `java.math.BigInteger`

Description: Read a 16\-byte integer using the provided endianness.
parameter: mem: virtual memory
parameter: endianness: endianness
parameter: address: memory address
return: big integer value, or null

## Static Method: readAsLongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- return type: `java.lang.Long`

Description: Read an integer \(byte, short, int or long\) and converts it to Long. Standard memory byte ordering is used for decoding. Memory protection is disregarded.
parameter: mem: the virtual memory
parameter: address: memory address of the data
parameter: size: any of 1, 2, 4, or 8
return: the long value or null on error

## Static Method: readAsLongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `endianness`, type: `com.pnfsoftware.jeb.util.io.Endianness`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- return type: `java.lang.Long`

Description: Read an integer and convert it to [Long](Long) using the provided endianness.
parameter: mem: virtual memory
parameter: endianness: endianness
parameter: address: memory address
parameter: size: any of 1, 2, 4, or 8
return: long value, or null

## Static Method: readAsUnsignedLongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- return type: `java.lang.Long`

Description: Read an integer \(byte, short, int or long\) and zero extend it to Long. Standard memory byte ordering is used for decoding. Note that if a signed long is read, the value may be negative \(overflow should be appreciated by caller\).
parameter: mem: the virtual memory
parameter: address: memory address of the data
parameter: size: any of 1, 2, 4, or 8
return: the long value or null on error

## Static Method: readAsUnsignedLongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `endianness`, type: `com.pnfsoftware.jeb.util.io.Endianness`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- return type: `java.lang.Long`

Description: Read an integer and zero\-extend it to [Long](Long) using the provided endianness.
parameter: mem: virtual memory
parameter: endianness: endianness
parameter: address: memory address
parameter: size: any of 1, 2, 4, or 8
return: long value, or null

## Static Method: readBEIntSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `int[]`
- return type: `boolean`

Description: Read a big\-endian 32\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readBELongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `long[]`
- return type: `boolean`

Description: Read a big\-endian 64\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readBEShortSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `short[]`
- return type: `boolean`

Description: Read a big\-endian 16\-bit integer.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readBooleans
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `boolean[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of booleans from memory. Each entry occupies 1 byte of memory, the lower\-significant bit of the byte indicates false\(0\) or true\(1\).
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to read
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readByte
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `byte[]`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read a byte safely \(this method does not raise [MemoryException](MemoryException)\). Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readByteSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `byte[]`
- return type: `boolean`

Description: Read a byte safely \(this method does not raise [MemoryException](MemoryException)\). Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readBytes
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of bytes from memory.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: destination array
parameter: offset: start offset in the destination array
parameter: count: count of elements to read from memory and write to the array
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readBytes
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- return type: `boolean`

Description: Read an array of bytes from memory. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: destination array
parameter: offset: start offset in the destination array
parameter: count: count of elements to read from memory and write to the array
return: success indicator

## Static Method: readBytesSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- parameter: `dst`, type: `byte[]`
- parameter: `dstOffset`, type: `int`
- parameter: `protection`, type: `int`
- return type: `int`

Description: Safely read at most the requested amount of bytes. Convert segment flags to virtual\-memory access flags.
parameter: mem: the memory
parameter: address: target address
parameter: size: requested read size
parameter: dst: destination buffer
parameter: dstOffset: position within the destination buffer
parameter: protection: the requested protection level, must contain at least            [IVirtualMemory#ACCESS_READ](IVirtualMemory#ACCESS_READ)
return: the number of bytes read; may be less than requested. \-1 if an unknown error occurs

## Static Method: readBytesSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `size`, type: `int`
- parameter: `dst`, type: `byte[]`
- parameter: `dstOffset`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `int`

Description: Safely read at most the requested amount of bytes.
parameter: mem: the memory
parameter: address: target address
parameter: size: requested read size
parameter: dst: destination buffer
parameter: dstOffset: position within the destination buffer
parameter: bypassProtection: if true, all pages will be read, including non\-resable pages; else,            only readable pages will be read
return: the number of bytes read; may be less than requested. \-1 if an unknown error occurs

## Static Method: readChars
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `char[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of chars from memory. Each entry occupies 2 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readDoubles
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `double[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of doubles from memory. Each entry occupies 8 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to read
parameter: bypassProtection: true to bypass memory protection checks
return: success indicator

## Static Method: readFloats
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `float[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of floats from memory. Each entry occupies 4 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to read
parameter: bypassProtection: true to bypass memory protection checks
return: success indicator

## Static Method: readInt
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `int[]`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read a 32\-bit integer using the memory standard endianness.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readInts
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `int[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of ints from memory. Each entry occupies 4 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to read
parameter: bypassProtection: true to bypass memory protection checks
return: success indicator

## Static Method: readLEIntSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `int[]`
- return type: `boolean`

Description: Read a little\-endian 32\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readLELongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `long[]`
- return type: `boolean`

Description: Read a little\-endian 64\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readLEShortSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `short[]`
- return type: `boolean`

Description: Read a little\-endian 16\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
return: success indicator

## Static Method: readLong
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `long[]`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read a 64\-bit integer using the memory standard endianness.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readLongs
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `long[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of longs from memory. Each entry occupies 8 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readNullTerminatedString
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- return type: `java.lang.String`

Description: Read a null\-terminated string from memory. No max size and UTF\-8 encoding are used. 

 This method does not raise [MemoryException](MemoryException).
parameter: mem: virtual memory
parameter: address: memory address
return: string, or null

## Static Method: readNullTerminatedString
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `maxSize`, type: `int`
- return type: `java.lang.String`

Description: Read a null\-terminated string from memory. A UTF\-8 encoding is used. 

 This method does not raise [MemoryException](MemoryException).
parameter: mem: virtual memory
parameter: address: memory address
parameter: maxSize: maximum number of bytes to read
return: string, or null

## Static Method: readNullTerminatedString
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `maxSize`, type: `int`
- parameter: `encoding`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Read a null\-terminated string from memory. 

 This method does not raise [MemoryException](MemoryException).
parameter: mem: virtual memory
parameter: address: memory address
parameter: maxSize: maximum count of bytes; use a negative value for int\-max \(~2Gb\)
parameter: encoding: null for the default UTF8, else, a valid encoding
return: string, or null

## Static Method: readNullTerminatedStringSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `maxSize`, type: `int`
- return type: `java.lang.String`

Description: Read from memory a series of ASCII characters, terminated by a null byte, and build the corresponding String. If no null\-byte is found, the search stops at the provided maxSize. 

 This method does not raise [MemoryException](MemoryException).
parameter: mem: a VM
parameter: address: memory address
parameter: maxSize: maximum string length in ascii characters
return: the string or null if a failure happened \(e.g. string is too long, memory error         occurred, etc.\)
deprecated: this method is deprecated. Prefer a flavor of `readNullTerminatedString` instead.

## Static Method: readSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `data`, type: `byte[]`
- return type: `boolean`

Description: Read an array of bytes from memory \(this method does not raise [MemoryException](MemoryException)\). Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: data: destination array
return: success indicator

## Static Method: readShort
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `out`, type: `short[]`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read a 16\-bit integer using the memory standard endianness.
parameter: mem: virtual memory
parameter: address: memory address
parameter: out: single\-element array that will receive the result of the read operation
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: readShorts
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `short[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Read an array of shorts from memory. Each entry occupies 2 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeBooleans
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `boolean[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of booleans to memory. Each entry occupies 1 byte whose value will be set to 0\(false\) or 1\(true\).
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeByte
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `byte`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an 8\-bit integer.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to be written
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeByte
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `byte`
- return type: `boolean`

Description: Write an 8\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to be written
return: success indicator

## Static Method: writeBytes
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of bytes to memory.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: source array
parameter: offset: start offset in the source array
parameter: count: count of elements to read from the array and write to the memory
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeBytes
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- return type: `boolean`

Description: Write an array of bytes to memory. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: source array
parameter: offset: start offset in the source array
parameter: count: count of elements to read from the array and write to the memory
return: success indicator

## Static Method: writeChars
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `char[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of chars to memory. Each entry occupies 2 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeDoubles
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `double[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of doubles to memory. Each entry occupies 8 bytes of memory. The encoding used is IEEE754. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: true to bypass memory protection checks
return: success indicator

## Static Method: writeFloats
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `float[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of floats to memory. Each entry occupies 4 bytes of memory. The encoding used is IEEE754. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeInt
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write a 32\-bit integer using the memory standard endianness.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeInts
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `int[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of ints to memory. Each entry occupies 4 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeLEIntSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `int`
- return type: `boolean`

Description: Write a little\-endian 32\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to be written
return: success indicator

## Static Method: writeLELongSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `long`
- return type: `boolean`

Description: Write a little\-endian 64\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to be written
return: success indicator

## Static Method: writeLEShortSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `short`
- return type: `boolean`

Description: Write a little\-endian 16\-bit integer. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to be written
return: success indicator

## Static Method: writeLong
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `long`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write a 64\-bit integer using the memory standard endianness.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeLongs
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `long[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of longs to memory. Each entry occupies 8 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeNullTerminatedBytes
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `maxSize`, type: `int`
- parameter: `bytes`, type: `byte[]`
- return type: `boolean`

Description: Write a sequence of bytes to memory. The sequence is appended by a null byte. If the sequence is too long, it is truncated to \(maxSize\-1\) bytes to allow the appending of a null terminator. 

 This method does not raise [MemoryException](MemoryException).
parameter: mem: virtual memory
parameter: address: destination address
parameter: maxSize: the maximum amount of bytes to write, including the added null terminator            \(must be strictly positive\)
parameter: bytes: the string bytes \(usually resulting from the ascii or utf8 encoding of the            string to be written to memory\)
return: success indicator

## Static Method: writeSafe
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `data`, type: `byte[]`
- return type: `boolean`

Description: Write an array of bytes to memory \(this method does not raise [MemoryException](MemoryException)\). Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: memory address
parameter: data: source array
return: success indicator

## Static Method: writeShort
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `v`, type: `short`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write a 16\-bit integer using the memory standard endianness.
parameter: mem: virtual memory
parameter: address: memory address
parameter: v: value to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeShorts
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `array`, type: `short[]`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write an array of shorts to memory. Each entry occupies 2 bytes of memory. Byte ordering is determined from the virtual memory endianness setting.
parameter: mem: virtual memory
parameter: address: memory address
parameter: array: array
parameter: offset: start offset in the array
parameter: count: count of elements to write
parameter: bypassProtection: if true, disregard memory protection
return: success indicator

## Static Method: writeSled
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `cnt`, type: `int`
- parameter: `val`, type: `byte`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write a sled of bytes.
parameter: mem: virtual memory
parameter: address: start memory address
parameter: cnt: count of bytes
parameter: val: byte value
parameter: bypassProtection: if true, disregard memory protection
return: success indicator.

## Static Method: writeStringField
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `objBaseAddress`, type: `long`
- parameter: `structType`, type: `com.pnfsoftware.jeb.core.units.code.asm.type.IStructureType`
- parameter: `fieldName`, type: `java.lang.String`
- parameter: `value`, type: `java.lang.String`
- return type: `boolean`

Description: Write the string field of a structure object to memory. The encoding used is UTF\-8. A null terminator is appended. The string is truncated to fit within the field, including the null terminator. 

 This method does not raise [MemoryException](MemoryException).
parameter: mem: virtual memory
parameter: objBaseAddress: base address of the object
parameter: structType: structure type
parameter: fieldName: field name
parameter: value: string value for the field
return: success indicator

## Static Method: writeZeros
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `address`, type: `long`
- parameter: `cnt`, type: `int`
- parameter: `bypassProtection`, type: `boolean`
- return type: `boolean`

Description: Write a sled of zeros. Memory protection is disregarded.
parameter: mem: virtual memory
parameter: address: start memory address
parameter: cnt: count of bytes
parameter: bypassProtection: if true, disregard memory protection
return: success indicator.

