public class RawMemoryFloatAccess extends RawMemoryAccess
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.
byteSwapEnabled_
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
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.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.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.
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.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.public double getDouble(long offset) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.offset
- the offset of the first byte from the beginning of
this memory range.public void getDoubles(long offset, double[] doubles, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.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.public float getFloat(long offset) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.offset
- the offset of the first byte from the beginning of
this memory range.public void getFloats(long offset, float[] floats, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.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.public void setFloat(long offset, float value) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.offset
- the offset of the first byte from the beginning of
this memory range.value
- the float to be written.public void setFloats(long offset, float[] floats, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.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.public void setDouble(long offset, double value) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.offset
- the offset of the first byte from the beginning of
this memory range.value
- the double to be written.public void setDoubles(long offset, double[] doubles, int low, int number) throws OffsetOutOfBoundsException, SizeOutOfBoundsException
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.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.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.