Java Doc for OSMemory.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » luni » platform » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.luni.platform 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.harmony.luni.platform.OSComponent
      org.apache.harmony.luni.platform.OSMemory

OSMemory
final class OSMemory extends OSComponent implements IMemorySystem(Code)
This class enables direct access to OS memory.

Methods that take OS addresses define such parameters as a Java long. The long value is interpreted based on the underlying platform pointer size, such that only the lowest significant POINTER_SIZE bytes of the long value are used. In practice this means that methods on 64-bit platforms use the full eight bytes of the address parameter, and on 32-bit platforms the same methods are truncated to use only the low four bytes.

Methods that return OS addresses define the return type to be a Java long. If the platform pointer size is less than eight bytes the OS address value is zero-extended to an eight-byte int to correspond to the subsequent interpretation of that jlong as an OS address as defined above.



Field Summary
final public static  EndiannessNATIVE_ORDER
     Defines the natural byte order for this machine.
final public static  intPOINTER_SIZE
     Defines the size, in bytes, of a native pointer type for the underlying platform.

Constructor Summary
 OSMemory()
     This class is not designed to be publically instantiated.

Method Summary
public  voidflush(long addr, long size)
    
native public  voidfree(long address)
     Deallocates space for a memory block that was previously allocated by a call to OSMemory.malloc(long) malloc(long) .
native public  longgetAddress(long address)
     Gets the value of the platform pointer at the given address.

The length of the platform pointer is defined by POINTER_SIZE.

The behavior is unspecified if (address ...
native public  bytegetByte(long address)
     Gets the value of the single byte at the given address.

The behavior is unspecified if address is not in the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the byte.
native public  voidgetByteArray(long address, byte[] bytes, int offset, int length)
     Copies length bytes from the memory block at address into the byte array bytes starting at element offset within the byte array.

The behavior of this method is undefined if the range (address ...

native public  doublegetDouble(long address)
     Gets the value of the IEEE754-format eight-byte float stored in platform byte order at the given address.

The behavior is unspecified if (address ...

public  doublegetDouble(long address, Endianness endianness)
    
native public  floatgetFloat(long address)
     Gets the value of the IEEE754-format four-byte float stored in platform byte order at the given address.

The behavior is unspecified if (address ...

public  floatgetFloat(long address, Endianness endianness)
    
native public  intgetInt(long address)
     Gets the value of the signed four-byte integer stored in platform byte-order at the given address.

The behavior is unspecified if (address ...

public  intgetInt(long address, Endianness endianness)
    
native public  longgetLong(long address)
     Gets the value of the signed eight-byte integer stored in platform byte order at the given address.

The behavior is unspecified if (address ...

public  longgetLong(long address, Endianness endianness)
    
public  EndiannessgetNativeOrder()
     Answers the natural byte order for this machine.
public static  OSMemorygetOSMemory()
    
public  intgetPointerSize()
    
native public  shortgetShort(long address)
     Gets the value of the signed two-byte integer stored in platform byte order at the given address.

The behavior is unspecified if (address ...

public  shortgetShort(long address, Endianness endianness)
    
public  booleanisLittleEndian()
    
native public static  booleanisLittleEndianImpl()
     Answers whether the byte order of this machine is little endian or not.. false for Big Endian, andtrue
public  booleanisLoaded(long addr, long size)
    
public  voidload(long addr, long size)
    
public  longmalloc(long length)
     Allocates and returns a pointer to space for a memory block of length bytes.
native public  voidmemmove(long destAddress, long srcAddress, long length)
     Copies length bytes from srcAddress to destAddress.
native public  voidmemset(long address, byte value, long length)
     Places value into first length bytes of the memory block starting at address.

The behavior is unspecified if (address ...

public  longmmap(long fileDescriptor, long alignment, long size, int mapMode)
    
native public  voidsetAddress(long address, long value)
     Sets the value of the platform pointer at the given address.

The length of the platform pointer is defined by POINTER_SIZE.

native public  voidsetByte(long address, byte value)
     Sets the given single byte value at the given address.
native public  voidsetByteArray(long address, byte[] bytes, int offset, int length)
     Copies length bytes from the byte array bytes into the memory block at address, starting at element offset within the byte array.

The behavior of this method is undefined if the range (address ...

native public  voidsetDouble(long address, double value)
     Sets the value of the IEEE754-format eight-byte float store in platform byte order at the given address.

The behavior is unspecified if (address ...

public  voidsetDouble(long address, double value, Endianness endianness)
    
native public  voidsetFloat(long address, float value)
     Sets the value of the IEEE754-format four-byte float stored in platform byte order at the given address.

The behavior is unspecified if (address ...

public  voidsetFloat(long address, float value, Endianness endianness)
    
native public  voidsetInt(long address, int value)
     Sets the value of the signed four-byte integer at the given address in platform byte order.

The behavior is unspecified if (address ...

public  voidsetInt(long address, int value, Endianness endianness)
    
native public  voidsetLong(long address, long value)
     Sets the value of the signed eight-byte integer at the given address in the platform byte order.

The behavior is unspecified if (address ...

public  voidsetLong(long address, long value, Endianness endianness)
    
native public  voidsetShort(long address, short value)
     Sets the value of the signed two-byte integer at the given address in platform byte order.

The behavior is unspecified if (address ...

public  voidsetShort(long address, short value, Endianness endianness)
    
public  voidunmap(long addr, long size)
    

Field Detail
NATIVE_ORDER
final public static Endianness NATIVE_ORDER(Code)
Defines the natural byte order for this machine.



POINTER_SIZE
final public static int POINTER_SIZE(Code)
Defines the size, in bytes, of a native pointer type for the underlying platform. This will be 4 (for 32-bit machines) or 8 (for 64-bit machines).




Constructor Detail
OSMemory
OSMemory()(Code)
This class is not designed to be publically instantiated.
See Also:   OSMemory.getOSMemory()




Method Detail
flush
public void flush(long addr, long size)(Code)



free
native public void free(long address)(Code)
Deallocates space for a memory block that was previously allocated by a call to OSMemory.malloc(long) malloc(long) . The number of bytes freed is identical to the number of bytes acquired when the memory block was allocated. If address is zero the method does nothing.

Freeing a pointer to a memory block that was not allocated by malloc() has unspecified effect.


Parameters:
  address - the address of the memory block to deallocate.



getAddress
native public long getAddress(long address)(Code)
Gets the value of the platform pointer at the given address.

The length of the platform pointer is defined by POINTER_SIZE.

The behavior is unspecified if (address ... address + POINTER_SIZE) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the platform pointer. the value of the platform pointer as a Java long.



getByte
native public byte getByte(long address)(Code)
Gets the value of the single byte at the given address.

The behavior is unspecified if address is not in the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the byte. the byte value.



getByteArray
native public void getByteArray(long address, byte[] bytes, int offset, int length) throws NullPointerException, IndexOutOfBoundsException(Code)
Copies length bytes from the memory block at address into the byte array bytes starting at element offset within the byte array.

The behavior of this method is undefined if the range (address ... address + length) is not within a memory block that was allocated using OSMemory.malloc(long) malloc(long) .


Parameters:
  address - the address of the OS memory block from which to copy bytes.
Parameters:
  bytes - the byte array into which to copy the bytes.
Parameters:
  offset - the index of the first element in bytes thatwill be overwritten.
Parameters:
  length - the total number of bytes to copy into the byte array.
throws:
  NullPointerException - if bytes is null.
throws:
  IndexOutOfBoundsException - if offset + length > bytes.length.



getDouble
native public double getDouble(long address)(Code)
Gets the value of the IEEE754-format eight-byte float stored in platform byte order at the given address.

The behavior is unspecified if (address ... address + 8) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the eight-byte value. the value of the eight-byte float as a Java double.



getDouble
public double getDouble(long address, Endianness endianness)(Code)



getFloat
native public float getFloat(long address)(Code)
Gets the value of the IEEE754-format four-byte float stored in platform byte order at the given address.

The behavior is unspecified if (address ... address + 4) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the eight-byte value. the value of the four-byte float as a Java float.



getFloat
public float getFloat(long address, Endianness endianness)(Code)



getInt
native public int getInt(long address)(Code)
Gets the value of the signed four-byte integer stored in platform byte-order at the given address.

The behavior is unspecified if (address ... address + 4) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the four-byte value. the value of the four-byte integer as a Java int.



getInt
public int getInt(long address, Endianness endianness)(Code)



getLong
native public long getLong(long address)(Code)
Gets the value of the signed eight-byte integer stored in platform byte order at the given address.

The behavior is unspecified if (address ... address + 8) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the eight-byte value. the value of the eight-byte integer as a Java long.



getLong
public long getLong(long address, Endianness endianness)(Code)



getNativeOrder
public Endianness getNativeOrder()(Code)
Answers the natural byte order for this machine. the native byte order for the current platform.



getOSMemory
public static OSMemory getOSMemory()(Code)



getPointerSize
public int getPointerSize()(Code)



getShort
native public short getShort(long address)(Code)
Gets the value of the signed two-byte integer stored in platform byte order at the given address.

The behavior is unspecified if (address ... address + 2) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the two-byte value. the value of the two-byte integer as a Java short.



getShort
public short getShort(long address, Endianness endianness)(Code)



isLittleEndian
public boolean isLittleEndian()(Code)



isLittleEndianImpl
native public static boolean isLittleEndianImpl()(Code)
Answers whether the byte order of this machine is little endian or not.. false for Big Endian, andtrue



isLoaded
public boolean isLoaded(long addr, long size)(Code)



load
public void load(long addr, long size)(Code)



malloc
public long malloc(long length) throws OutOfMemoryError(Code)
Allocates and returns a pointer to space for a memory block of length bytes. The space is uninitialized and may be larger than the number of bytes requested; however, the guaranteed usable memory block is exactly length bytes long.
Parameters:
  length - number of bytes requested. the address of the start of the memory block.
throws:
  OutOfMemoryError - if the request cannot be satisfied.



memmove
native public void memmove(long destAddress, long srcAddress, long length)(Code)
Copies length bytes from srcAddress to destAddress. Where any part of the source memory block and the destination memory block overlap memmove() ensures that the original source bytes in the overlapping region are copied before being overwritten.

The behavior is unspecified if (srcAddress ... srcAddress + length) and (destAddress ... destAddress + length) are not both wholly within the range that was previously allocated using malloc().


Parameters:
  destAddress - the address of the destination memory block.
Parameters:
  srcAddress - the address of the source memory block.
Parameters:
  length - the number of bytes to move.



memset
native public void memset(long address, byte value, long length)(Code)
Places value into first length bytes of the memory block starting at address.

The behavior is unspecified if (address ... address + length) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the address of the first memory location.
Parameters:
  value - the byte value to set at each location.
Parameters:
  length - the number of byte-length locations to set.



mmap
public long mmap(long fileDescriptor, long alignment, long size, int mapMode) throws IOException(Code)



setAddress
native public void setAddress(long address, long value)(Code)
Sets the value of the platform pointer at the given address.

The length of the platform pointer is defined by POINTER_SIZE. This method only sets POINTER_SIZE bytes at the given address.

The behavior is unspecified if (address ... address + POINTER_SIZE) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the platform pointer.
Parameters:
  value - the value of the platform pointer as a Java long.



setByte
native public void setByte(long address, byte value)(Code)
Sets the given single byte value at the given address.

The behavior is unspecified if address is not in the range that was previously allocated using malloc().


Parameters:
  address - the address at which to set the byte value.
Parameters:
  value - the value to set.



setByteArray
native public void setByteArray(long address, byte[] bytes, int offset, int length) throws NullPointerException, IndexOutOfBoundsException(Code)
Copies length bytes from the byte array bytes into the memory block at address, starting at element offset within the byte array.

The behavior of this method is undefined if the range (address ... address + length) is not within a memory block that was allocated using OSMemory.malloc(long) malloc(long) .


Parameters:
  address - the address of the OS memory block into which to copy thebytes.
Parameters:
  bytes - the byte array from which to copy the bytes.
Parameters:
  offset - the index of the first element in bytes thatwill be read.
Parameters:
  length - the total number of bytes to copy from bytesinto the memory block.
throws:
  NullPointerException - if bytes is null.
throws:
  IndexOutOfBoundsException - if offset + length > bytes.length.



setDouble
native public void setDouble(long address, double value)(Code)
Sets the value of the IEEE754-format eight-byte float store in platform byte order at the given address.

The behavior is unspecified if (address ... address + 8) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the eight-byte value.
Parameters:
  value - the value of the eight-byte float as a Javadouble.



setDouble
public void setDouble(long address, double value, Endianness endianness)(Code)



setFloat
native public void setFloat(long address, float value)(Code)
Sets the value of the IEEE754-format four-byte float stored in platform byte order at the given address.

The behavior is unspecified if (address ... address + 4) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the eight-byte value.
Parameters:
  value - the value of the four-byte float as a Java float.



setFloat
public void setFloat(long address, float value, Endianness endianness)(Code)



setInt
native public void setInt(long address, int value)(Code)
Sets the value of the signed four-byte integer at the given address in platform byte order.

The behavior is unspecified if (address ... address + 4) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the four-byte value.
Parameters:
  value - the value of the four-byte integer as a Java int.



setInt
public void setInt(long address, int value, Endianness endianness)(Code)



setLong
native public void setLong(long address, long value)(Code)
Sets the value of the signed eight-byte integer at the given address in the platform byte order.

The behavior is unspecified if (address ... address + 8) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the eight-byte value.
Parameters:
  value - the value of the eight-byte integer as a Javalong.



setLong
public void setLong(long address, long value, Endianness endianness)(Code)



setShort
native public void setShort(long address, short value)(Code)
Sets the value of the signed two-byte integer at the given address in platform byte order.

The behavior is unspecified if (address ... address + 2) is not wholly within the range that was previously allocated using malloc().


Parameters:
  address - the platform address of the start of the two-byte value.
Parameters:
  value - the value of the two-byte integer as a Java short.



setShort
public void setShort(long address, short value, Endianness endianness)(Code)



unmap
public void unmap(long addr, long size)(Code)



Methods inherited from org.apache.harmony.luni.platform.OSComponent
public Object getAdapter(Class adapter)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.