|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.RawMemoryAccess
javax.realtime.RawMemoryFloatAccess
public class RawMemoryFloatAccess
Jamaica Real-Time Specification for Java class RawMemoryFloatAccess
This class enables the low-level access of a range of physical memory as a sequence of bytes. This class permits the development of device drivers using memory-mapped I/O, flash memory, battery-backed RAM, etc.
The memory can be accessed as primitive types byte, short, int, long, float, double, or as arrays of these primitive types. No non-primitive types (Java references or Java objects) can be stored in this memory since this would undermine Java's inherent type safety for references and objects.
The byte ordering on accesses to the memory depends on the current setting of RealtimeSystem.BYTE_ORDER.
Field Summary |
---|
Fields inherited from class javax.realtime.RawMemoryAccess |
---|
byteSwapEnabled_ |
Constructor Summary | |
---|---|
RawMemoryFloatAccess(Object type,
long size)
Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible. |
|
RawMemoryFloatAccess(Object type,
long base,
long size)
Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible. |
Method Summary | |
---|---|
double |
getDouble(long offset)
getDouble reads a double from the given offset. |
void |
getDoubles(long offset,
double[] doubles,
int low,
int number)
getDoubles reads a number of doubles from the given offset. |
float |
getFloat(long offset)
getFloat reads a float from the given offset. |
void |
getFloats(long offset,
float[] floats,
int low,
int number)
getFloats reads a number of floats from the given offset. |
void |
setDouble(long offset,
double value)
setDouble writes a double to the given offset. |
void |
setDoubles(long offset,
double[] doubles,
int low,
int number)
setDoubles writes a number of doubles to the given offset. |
void |
setFloat(long offset,
float value)
setFloat writes a float to the given offset. |
void |
setFloats(long offset,
float[] floats,
int low,
int number)
setFloats writes a number of floats to the given offset. |
Methods inherited from class javax.realtime.RawMemoryAccess |
---|
getByte, getBytes, getInt, getInts, getLong, getLongs, getMappedAddress, getShort, getShorts, map, map, map, setByte, setBytes, setInt, setInts, setLong, setLongs, setShort, setShorts, swapBytes, swapBytes, swapBytes, unmap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RawMemoryFloatAccess(Object type, long size) throws SecurityException, OffsetOutOfBoundsException, SizeOutOfBoundsException, UnsupportedPhysicalMemoryException, MemoryTypeConflictException, OutOfMemoryError
Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible.
The base address will be chosen freely by the implementation.
type
- The type of the memory (e.g.,
PhysicalMemoryManager.DMA, etc). This may be an array of types if
several type attributes are required. type may be null if any
memory type is acceptable.size
- the size of the range.
SecurityException
- if the application is not allowed to
access physical memory or memory of the specified type.
SizeOutOfBoundsException
- iff size is negative or base
plus size extends into an illegal memory range.
OffsetOutOfBoundsException
- iff base is invalid.
UnsupportedPhysicalMemoryException
- if the specified
memory type is not supported.
MemoryTypeConflictException
- if the memory at the
specified base address is incompatible with the attributes
specified in the type parameter.
OutOfMemoryError
- if there is no memory of the specified
type available.public RawMemoryFloatAccess(Object type, long base, long size) throws SecurityException, OffsetOutOfBoundsException, SizeOutOfBoundsException, UnsupportedPhysicalMemoryException, MemoryTypeConflictException, OutOfMemoryError
Constructor to create an instance of RawMemoryFloatAccess for the given parameters and make this memory accessible.
JamaicaVM currently does not support virtual memory, so no mapping of the specified memory will be performed by this constructor.
type
- The type of the memory (e.g.,
PhysicalMemoryManager.DMA, etc). This may be an array of types if
several type attributes are required. type may be null if any
memory type is acceptable.base
- the base address of the range.size
- the size of the range.
SecurityException
- if the application is not allowed to
access the specified range of memory or memory type.
SizeOutOfBoundsException
- iff size is negative or base
plus size extends into an illegal memory range.
OffsetOutOfBoundsException
- iff base is invalid.
UnsupportedPhysicalMemoryException
- if the specified
memory type is not supported.
MemoryTypeConflictException
- if the memory at the
specified base address is incompatible with the attributes
specified in the type parameter.
OutOfMemoryError
- if there is no memory of the specified
type available.Method Detail |
---|
public double getDouble(long offset) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the first byte from the beginning of
this memory range.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.public void getDoubles(long offset, double[] doubles, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the doubles from the beginning of this
memory range.doubles
- (out!) an array to hold the read doubles.low
- offset in doubles array where the first value is stored.number
- number of doubles to be read.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException
- if low < 0 or (low +
number) >= doubles.length or (low + number) < 0.
IllegalArgumentException
- if doubles is null or number < 0.public float getFloat(long offset) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the first byte from the beginning of
this memory range.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.public void getFloats(long offset, float[] floats, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the floats from the beginning of this
memory range.floats
- (out!) an array to hold the read floats.low
- offset in floats array where the first value is stored.number
- number of floats to be read.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException
- if low < 0 or (low +
number) >= floats.length or (low + number) < 0.
IllegalArgumentException
- if floats is null or number < 0.public void setFloat(long offset, float value) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the first byte from the beginning of
this memory range.value
- the float to be written.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.public void setFloats(long offset, float[] floats, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the floats from the beginning of this
memory range.floats
- an array that holds the floats to be written.low
- offset in floats array where the first value to be
written will be taken from.number
- number of floats to be written.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException
- if low < 0 or (low +
number) >= floats.length or (low + number) < 0.
IllegalArgumentException
- if floats is null or number < 0.public void setDouble(long offset, double value) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the first byte from the beginning of
this memory range.value
- the double to be written.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.public void setDoubles(long offset, double[] doubles, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
offset
- the offset of the doubles from the beginning of this
memory range.doubles
- an array that holds the doubles to be written.low
- offset in doubles array where the first value to be
written will be taken from.number
- number of doubles to be written.
SizeOutOfBoundsException
- if this is not mapped or offset
specifies an address in an invalid address range.
OffsetOutOfBoundsException
- if offset is negative or
greater than the size of the raw memory area.
ArrayIndexOutOfBoundsException
- if low < 0 or (low +
number) >= doubles.length or (low + number) < 0.
IllegalArgumentException
- if doubles is null or number < 0.
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |