FileDocCategorySizeDatePackage
PlatformAddressFactory.javaAPI DocAndroid 1.5 API2973Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.platform

PlatformAddressFactory

public class PlatformAddressFactory extends Object

Fields Summary
Constructors Summary
Methods Summary
public static PlatformAddressalloc(int size)
Allocates a contiguous block of OS heap memory.

param
size The number of bytes to allocate from the system heap.
return
PlatformAddress representing the memory block.

        int osAddress = PlatformAddress.osMemory.malloc(size);
        PlatformAddress newMemory = on(osAddress, size);
        PlatformAddress.memorySpy.alloc(newMemory);
        return newMemory;
    
public static PlatformAddressalloc(int size, byte init)
Allocates a contiguous block of OS heap memory and initializes it to a given value.

param
size The number of bytes to allocate from the system heap.
param
init The value to initialize the memory.
return
PlatformAddress representing the memory block.

        int osAddress = PlatformAddress.osMemory.malloc(size);
        PlatformAddress.osMemory.memset(osAddress, init, size);
        PlatformAddress newMemory = on(osAddress, size);
        PlatformAddress.memorySpy.alloc(newMemory);
        return newMemory;
    
public static PlatformAddressallocMap(int fd, long start, long size, int mode)

        int osAddress = PlatformAddress.osMemory.mmap(fd, start, size, mode);
        PlatformAddress newMemory = mapOn(osAddress, size);
        PlatformAddress.memorySpy.alloc(newMemory);
        return newMemory;
    
public static MappedPlatformAddressmapOn(int value, long size)

        MappedPlatformAddress addr = new MappedPlatformAddress(value, size);
        return addr;
    
public static PlatformAddresson(int value)

        return PlatformAddressFactory.on(value, PlatformAddress.UNKNOWN);
    
public static PlatformAddresson(int value, long size)

        PlatformAddress addr = (value == 0) ? PlatformAddress.NULL : new PlatformAddress(value, size);
        return addr;