| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
createDataArray(Object templ,
int numElements)
Create an array of a particular type.
|
static void |
dumpRange(Address start,
Address end)
Dump a range in format [start,end)
|
abstract void |
formatSize(Address buffer,
int size)
Pretty print a size, converting from bytes to kilo- or mega-bytes as appropriate
|
abstract Address |
formatSize(String format,
int bufsize,
int size)
Pretty print a size, converting from bytes to kilo- or mega-bytes as appropriate
|
abstract void |
free(Address addr)
Free an array of bytes previously allocated with malloc
|
abstract Address |
getBytes(String str)
Convert a String to a 0-terminated array of bytes
|
abstract Address |
malloc(int size)
Allocate an array of bytes with malloc
|
static int |
numToBytes(byte[] buffer,
long value)
Place a string representation of a long in an array of bytes
without incurring allocation
|
static int |
numToBytes(byte[] buffer,
long value,
int radix)
Place a string representation of a long in an array of bytes
without incurring allocation
|
abstract int |
sprintf(Address str,
Address format,
Address value)
sprintf(char *str, char *format, char* value) |
public Util()
public abstract Address malloc(int size)
size - The size to allocatefree(org.vmmagic.unboxed.Address)public abstract void free(Address addr)
addr - The address of some memory previously allocated with mallocmalloc(int)public static void dumpRange(Address start, Address end)
start - The start of the rangeend - The end of the rangepublic abstract Address getBytes(String str)
str - The string to convertpublic abstract void formatSize(Address buffer, int size)
buffer - The buffer (in C space) in which to place the formatted sizesize - The size in bytespublic abstract Address formatSize(String format, int bufsize, int size)
format - A format stringbufsize - The size of a buffer large enough to hold the formatted resultsize - The size in bytespublic static int numToBytes(byte[] buffer, long value)
buffer - The byte arrayvalue - The long to convertpublic static int numToBytes(byte[] buffer, long value, int radix)
buffer - The byte arrayvalue - The long to convertradix - the base to use for conversionpublic abstract int sprintf(Address str, Address format, Address value)
sprintf(char *str, char *format, char* value)str - The destination 'string' (memory in C space)format - The format 'string' (memory in C space)value - The value 'string' (memory in C space)public abstract Object createDataArray(Object templ, int numElements)
Foo[] x = (Foo [])Stream.createDataArray(new Foo[0], numElements);templ - a data array to use as a templatenumElements - number of elements in new array