public interface RawBlock extends RawMemory
RawBlock interface provides methods to access a continuous range of physical memory (raw memory). A
RawBlock instance can be obtained from a MMIODevice instance.
The index values map to physical memory addresses. The index values are measured in bytes. The
index values are relative to the base address of the raw memory area. The index value 0
corresponds to the base address of raw memory area.
The byte ordering of the underlying raw memory area can be retrieved using the MMIODevice.getByteOrdering()
method.| Modifier and Type | Method and Description |
|---|---|
byte |
getByte(int index)
Reads the
byte at the given index in the raw memory area associated with this object. |
void |
getBytes(int index,
byte[] dst,
int offset,
int length)
Reads
bytes starting at the given index in the raw memory area associated with this object. |
int |
getInt(int index)
Reads the
int at the given index in the raw memory area associated with this object. |
void |
getInts(int index,
int[] dst,
int offset,
int length)
Reads
ints starting at the given index in the raw memory area associated with this object. |
short |
getShort(int index)
Reads the
short at the given index in the raw memory area associated with this object. |
void |
getShorts(int index,
short[] dst,
int offset,
int length)
Reads
shorts starting at the given index in the raw memory area associated with this object. |
int |
getSize()
Gets the size in bytes of the raw memory area associated with this object.
|
void |
setByte(int index,
byte value)
Writes the given
byte at the given index in the raw memory area associated with this object. |
void |
setBytes(int index,
byte[] src,
int offset,
int length)
Writes
bytes starting at the given index in the raw memory area associated with this object. |
void |
setInt(int index,
int value)
Writes the given
int at the given index in the raw memory area associated with this object. |
void |
setInts(int index,
int[] src,
int offset,
int length)
Writes
ints starting at the given index in the raw memory area associated with this object. |
void |
setShort(int index,
short value)
Writes the given
short at the given index in the raw memory area associated with this object. |
void |
setShorts(int index,
short[] src,
int offset,
int length)
Writes
shorts starting at the given index in the raw memory area associated with this object. |
byte getByte(int index)
throws java.io.IOException,
PeripheralNotAvailableException
byte at the given index in the raw memory area associated with this object.index - the byte index in the raw memory area from which the byte will be read.byte at the given index in the raw memory area.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.io.IOException - if the associated memory area is not readable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void getBytes(int index,
byte[] dst,
int offset,
int length)
throws java.io.IOException,
PeripheralNotAvailableException
bytes starting at the given index in the raw memory area associated with this object. This method
transfers bytes from the raw memory area into the given destination array. Each byte is loaded
from memory in a single atomic operation.index - the byte index in the raw memory area from which the bytes will be read.dst - the array into which bytes are to be writtenoffset - the offset within the array of the first byte to be written; must be non-negative and no
larger than dst.length.length - the maximum number of bytes to be written to the given array; must be non-negative and no
larger than dst.length - offset.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.lang.IndexOutOfBoundsException - if the preconditions on the offset and length parameters do not hold.java.io.IOException - if the associated memory area is not readable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).int getInt(int index)
throws java.io.IOException,
PeripheralNotAvailableException
int at the given index in the raw memory area associated with this object.index - the byte index in the raw memory area from which the int will be read.int at the given index in the raw memory area.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.io.IOException - if the associated memory area is not readable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void getInts(int index,
int[] dst,
int offset,
int length)
throws java.io.IOException,
PeripheralNotAvailableException
ints starting at the given index in the raw memory area associated with this object. This method
transfers ints from the raw memory area into the given destination array. Each byte is loaded from memory
in a single atomic operation.
If the ints are aligned on natural boundaries each int is loaded from memory in a single atomic
operation. Groups of ints may be loaded together, but this is unspecified.
index - the byte index in the raw memory area from which the ints will be read.dst - the array into which ints are to be writtenoffset - the offset within the array of the first int to be written; must be non-negative and no larger
than dst.length.length - the maximum number of ints to be written to the given array; must be non-negative and no
larger than dst.length - offset.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.lang.IndexOutOfBoundsException - if the preconditions on the offset and length parameters do not hold.java.io.IOException - if the associated memory area is not readable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).short getShort(int index)
throws java.io.IOException,
PeripheralNotAvailableException
short at the given index in the raw memory area associated with this object.index - the byte index in the raw memory area from which the short will be read.short at the given index in the raw memory area.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.io.IOException - if the associated memory area is not readable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void getShorts(int index,
short[] dst,
int offset,
int length)
throws java.io.IOException,
PeripheralNotAvailableException
shorts starting at the given index in the raw memory area associated with this object. This method
transfers shorts from the raw memory area into the given destination array. Each byte is loaded from
memory in a single atomic operation.
If the shorts are aligned on natural boundaries each short is loaded from memory in a single
atomic operation. Groups of shorts may be loaded together, but this is unspecified.
index - the byte index in the raw memory area from which the shorts will be read.dst - the array into which shorts are to be writtenoffset - the offset within the array of the first short to be written; must be non-negative and no
larger than dst.length.length - the maximum number of shorts to be written to the given array; must be non-negative and no
larger than dst.length - offset.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.lang.IndexOutOfBoundsException - if the preconditions on the offset and length parameters do not hold.java.io.IOException - if the associated memory area is not readable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).int getSize()
throws PeripheralNotAvailableException
PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void setByte(int index,
byte value)
throws java.io.IOException,
PeripheralNotAvailableException
byte at the given index in the raw memory area associated with this object.
This memory access may involve a load and a store, and it may have unspecified effects on surrounding bytes in
the presence of concurrent access.index - the byte index in the raw memory area at which the byte will be written.value - the byte to be written at the given index in the raw memory area.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.io.IOException - if the associated memory area is not writable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void setBytes(int index,
byte[] src,
int offset,
int length)
throws java.io.IOException,
PeripheralNotAvailableException
bytes starting at the given index in the raw memory area associated with this object. This method
transfers bytes from the given source array into the raw memory area.
This memory access may involve multiple load and a store operations, and it may have unspecified effects on
surrounding bytes (even bytes in the range being stored) in the presence of concurrent access.index - the byte index in the raw memory area at which the bytes will be written.src - the array from which bytes are to be read.offset - the offset within the array of the first byte to be read; must be non-negative and no larger
than src.length.length - the maximum number of bytes to be written to the given array; must be non-negative and no
larger than src.length - offset.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.lang.IndexOutOfBoundsException - if the preconditions on the offset and length parameters do not hold.java.io.IOException - if the associated memory area is not writable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void setInt(int index,
int value)
throws java.io.IOException,
PeripheralNotAvailableException
int at the given index in the raw memory area associated with this object.
This memory access may involve a load and a store, and it may have unspecified effects on surrounding bytes in
the presence of concurrent access.index - the byte index in the raw memory area from which the int will be written.value - the int to be written at the given index in the raw memory area.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.io.IOException - if the associated memory area is not writable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void setInts(int index,
int[] src,
int offset,
int length)
throws java.io.IOException,
PeripheralNotAvailableException
ints starting at the given index in the raw memory area associated with this object. This method
transfers ints from the given source array into the raw memory area.
This memory access may involve multiple load and a store operations, and it may have unspecified effects on
surrounding bytes (even bytes in the range being stored) in the presence of concurrent access.index - the byte index in the raw memory area at which the int s will be written.src - the array from which ints are to be read.offset - the offset within the array of the first int to be read; must be non-negative and no larger
than src.length.length - the maximum number of ints to be written to the given array; must be non-negative and no
larger than src.length - offset.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.lang.IndexOutOfBoundsException - if the preconditions on the offset and length parameters do not hold.java.io.IOException - if the associated memory area is not writable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void setShort(int index,
short value)
throws java.io.IOException,
PeripheralNotAvailableException
short at the given index in the raw memory area associated with this object.
This memory access may involve a load and a store, and it may have unspecified effects on surrounding bytes in
the presence of concurrent access.index - the byte index in the raw memory area from which the short will be written.value - the short to be written at the given index in the raw memory area.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.io.IOException - if the associated memory area is not writable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void setShorts(int index,
short[] src,
int offset,
int length)
throws java.io.IOException,
PeripheralNotAvailableException
shorts starting at the given index in the raw memory area associated with this object. This method
transfers shorts from the given source array into the raw memory area.
This memory access may involve multiple load and a store operations, and it may have unspecified effects on
surrounding bytes (even bytes in the range being stored) in the presence of concurrent access.index - the byte index in the raw memory area at which the shorts will be written.src - the array from which shorts are to be read.offset - the offset within the array of the first short to be read; must be non-negative and no larger
than src.length.length - the maximum number of shorts to be written to the given array; must be non-negative and no
larger than src.length - offset.AccessOutOfBoundsException - if index would result in pointing outside the raw memory area associated with this object.java.lang.IndexOutOfBoundsException - if the preconditions on the offset and length parameters do not hold.java.io.IOException - if the associated memory area is not writable.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).Copyright (c) 1990, 2013, Oracle and/or its affiliates. All rights reserved.